Support » Plugin: Simple Lightbox » Lightbox with custom Ajax load

  • Resolved pierrepierrepierre

    (@pierrepierrepierre)


    Hello all, and thanks for this classic plugin !

    I’m working on a project where I build a custom function to load contents inside of drawers thanks to jQuery.
    The site consist of a main page with empty blocks referring to an article.
    Instead of opening a single article, clicking on a block loads that article inside the main page.

    I added an image with a link on my main page so it’s loading correctly all the scripts for Simple Lightbox.

    But still, I don’t exactly understand why but, since I only load a part of a page dynamically, the plugin doesn’t seems to work.
    If i go on the single article page, it works correctly.

    I think I don’t really understand how the plugin triggers the animation or captures the click on the image…

    Here is the jQuery code I use to load the part of the page I need :

             $.get(url, function(html){
               var doc = $(html);
    
               // Append loaded content to the correct div
               section.append(doc.find('.chapter-container > *'));
    
               target.addClass("loaded open"); // Sesame
    
               // Direct access to a subsection
               if ( subsection ) {
                 scrollTo(subsection, 50);
               }
    
               isAnimating = false;
    
               $( document.body ).on( 'post-load', function () {
                 // New content has been added to the page.
               } );
    
             });

    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.