• Hi all,

    I’m running a custom theme made from scratch, trying to implement Infinite Scroll.
    The wp plugin didn’t work, so I hardcoded it, got the css selectors right, and it appears to work.

    I have two divs in my post div, the latter of which I added in to simplify things. One of those divs is an image box, which rotates by using links that use javascript to change the image.

    However there’s an issue where the javascript used to control those images basically breaks. For example, if I have 4 ‘posts’ per page (each consisting of this image+control div), the first 4 load fine. I’ve verified this by debugging with alert();, which gives me 4 popups, 1 per post. However when I scroll down, upon triggering the scroll, it will only alert once, and that’s literally the only javascript that appears to work. My ‘image gallery’ is rendered useless on any page >= 2.

    Does anyone have any suggestions?

    A couple notes, something odd that I noticed is that my $jq(‘#content’).infinitescroll(); only works when it’s nearly at the end of my code, like we’re talking it only works when I insert it after the navigation links div. (Isn’t it supposed to work in head, or am I wrong?)

    Also, the reason it’s $jq and not $, or jQuery, is because I’m using jQuery in the imagebox control div, and $jq for infinite scroll.

    Hence, this is my header:

    <head>
    ...
    <script src="http://code.jquery.com/jquery-1.7.1.js"></script>
    <script>
      var $jq = jQuery.noConflict();
    </script>
    <script src="<?php bloginfo('template_directory'); ?>/js/jquery.infinitescroll.js"></script>
    </head>
Viewing 1 replies (of 1 total)
  • Thread Starter trakout

    (@trakout)

    For anyone wanting to see what I’m working with, here’s a link to the site, without any Infinite scrolling code.

    Also, it’s worth noting that my problem feels a lot like this, especially with regard to the words “working on the first page, but not on subsequent pages.”

Viewing 1 replies (of 1 total)

The topic ‘[Plugin : Infinite Scroll] Javascript not loading on scroll’ is closed to new replies.