WordPress.org

Ready to get started?Download WordPress

Forums

Advanced AJAX Page Loader
[resolved] NextGEN Gallery Slideshow; Let's solve this together. (10 posts)

  1. David Bitton
    Member
    Posted 1 year ago #

    As we all are familiar, the NextGEN slideshow doesn't work correctly when using AAPL. I spent some time looking into the code, and it really comes down to this snippet of HTML from the actual page:

    <div id="ngg-slideshow-3-986-1" class="ngg-slideshow" style="height:675px;width:900px;">
    	<div id="ngg-slideshow-3-986-1-loader" class="ngg-slideshow-loader" style="height:675px;width:900px;">
    		<img src="http://xxxxxxxxxxxxxx.cloudfront.net/wp-content/plugins/nextgen-gallery/images/loader.gif" class="ov-done" width="66" height="66" alt="" />
    	</div>
    </div>
    <script type="text/javascript" defer="defer">
    jQuery(document).ready(function(){
    jQuery("#ngg-slideshow-3-986-1").nggSlideshow( {id: 3,fx:"fade",width:900,height:675,domain: "http://abc.def.com/",timeout:4000});
    });
    </script>

    NextGEN outputs this snippet for each shortcode found within the page/post. That goes for the script block as well. Then the deferred script relies on the document being ready. Well, the page is only ready once. The subsequent AJAX calls do not result in this event being fired again. Also, you can't re-fire the ready event.

    The solution may come down to using jQuery to hunt down the code, and try and figure out a way to call the code in the ready event callback. Ideas?

    http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

  2. David Bitton
    Member
    Posted 1 year ago #

    Here is the necessary reload code for NextGEN slideshows:

    var slideshows = jQuery("[id^=ngg-slideshow]");
    
    for(i=0;i<slideshows.length;i++){
    	var d = slideshows.eq(i);
    	var s = d.next();
    	var h = s.html();
    	var c = h.split("\n")[2];
    	console.log("Evaluating:\r\n" + c);
    	eval(c);
    }
  3. David Bitton
    Member
    Posted 1 year ago #

    Whoops. change the selector to:

    var slideshows = jQuery(".ngg-slideshow");

    is was also grabbing the loader div.

  4. kings3jm
    Member
    Posted 1 year ago #

    Weird, that code was working up until a few days ago. Now it doesn't anymore. No updates were done, anyone know why it suddenly stopped?

  5. David Bitton
    Member
    Posted 1 year ago #

    Did NextGEN release an update?

  6. kings3jm
    Member
    Posted 1 year ago #

    Yes, they just updated the NextGen Plugin and now the reload code no longer works. :/ I've reverted the plugin back to the old version for now. Anyone figure out the new reload code??

  7. David Bitton
    Member
    Posted 1 year ago #

    I started working on it. It comes down to the fact that 2.0.x only inserts <script/> tags in <head/> on pages with slideshows. So I now have to figure out how to extract that in the Data Ajax Loaded Code. This isn't going to be easy.

  8. hypermotion
    Member
    Posted 2 months ago #

    What I did to make Nextgen run with ajax loaded content (AAPL in my case as well) - it's a really ugly solution - but it works with Nextgen 2 and my installation:
    I inserted one Nextgen gallery into footer code (through shortcode) so I know it is executed on every page one can enter.
    Then I used CSS and set "display: none;" to the container's CSS style to hide it for all pages.
    All Nextgen javascripts are loaded in head now and all functionality started to work.

    Why does this work?
    If I do load content with ajax head is not modified - only the content, so if first page I open through browser ULR bar doesn't include Nextgen gallery, then the necessary scripts are not loaded into my website.
    You can make sure if you do have the same problem as me by typing in browser's URL Bar the address to the page that has Nextgen gallery inserted (Nextgen will add the javascripts to head then, if You start with a page that doesn't have Nextgen gallery it won't work when You ajax-change your page to one with gallery).

    I did find load codes for AAPL but as in other cases they must have stopped working at some point.

  9. SeacatDesigns
    Member
    Posted 2 months ago #

    Adding the small gallery to the bottom of the page so that it shows on all pages doesnt work for me. Having the small gallery makes the styling for the thumbnails load, but thats it. The lightbox effect doesnt work, it just goes to the image link.

  10. SeacatDesigns
    Member
    Posted 2 months ago #

    Ohh this is for the slideshow, not the thumbnail gallery. Doi! I just had to load the lightbox-init javascript file to get it to work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic