How can I trigger "page ready" via jQuery?

Moved Unsolved NodeBB Development
  • #1


    I have some jQuery scripts on my theme which works fine.

    But if I reload the page via the refresh button, the script doesn't load.

    currently I am using:

    $(document).ready(function() {

    Which is fine if I click inside the forum. But when I try to reach the direct URL, the script does not execute. As well (as meantioned) If i reload the page.

    I tried it with the following listeners:

    $(window).on('action:ajaxify.end', function(event, data) {
    $(window).on('action:ajaxify.dataLoaded', function(event, data) {
    $(window).on('action:posts.loaded', function(event, data) {

    Same probem. If I reload the page, it doesn't work. If I call the URL directly, it doesn't work.

    If I surf inside the forum, it works.

    Whats the problem?

  • NodeBB

    How are you including the scripts in your forum?

  • #3

    @baris I include the script with


    This happens trough a created template.

    The template is imported after the posts.tpl in the topic.

  • NodeBB

    That should work I think, you can also try putting your scripts in the ACP at /admin/appearance/customise#custom-js

Suggested Topics

| | | |