• Hi,

    we had the issue that the ticker sometimes would not start to animate

    after some logging i found out that pj-news-ticker is using the js code window onload inside document ready

    after some digging on the intenet i found evidence that window.onload does in fact fire up before document ready but because of jquery implementation it can delay. especially if the page content is huge e.g. if you have an iframe inside, this will almost every time delay window.onload

    long story short, we should never depend on document.ready, when we want to use window load.

    so to fix the not running ticker we need to either move the window load part outside of document ready, or (like in pj-news-ticker) remove the document ready part completely because it is not used for anything else…

    so instead of this

    jQuery(document).ready(function ($) {
        // wait for fonts to load, to ensure correct width() calc
        $(window).bind("load", function () {
            console.log('step: inline document ready bind of load - pjnt-content & pjntinit()');
            $('.pjnt-content').pjntinit();
        });
    });

    we need to do this

    // wait for fonts to load, to ensure correct width() calc
    jQuery(window).bind("load", function () {
        jQuery('.pjnt-content').pjntinit();
    });

    i would like to get a comment from the plugin developer and if possible an update to the plugin so we dont need to modify the code ourselfs if there are any updates in the future…

  • The topic ‘Bug in code, pjntinit() can fail’ is closed to new replies.