• Resolved abbm

    (@abbm)


    I am trying to use wp_video_lightbox in conjuction with AjaxLoadMore. Video links at the top of the page work fine with a lightbox. However, videos links in content loaded through AJAX simply go through to YouTube. You can see the result here: http://www.thermocow.com

    It’s sounds like the same problem as https://wordpress.org/support/topic/links-loaded-from-ajax

    However, the solution in that post isn’t working for me. If I add that javascript code to the end of alm_query_posts() in the AjaxLoadMore script, the script just hangs.

    More specifically, if I use the following code, it hangs inside prettyPhoto():

    var elems = document.getElementsByTagName("a");
    for ( var i = 0; i < elems.length; i += 1 ) {
            if ( elems[i].hasAttribute("rel") && elems[i].getAttribute("rel") == "AJAX-wp-video-lightbox" )
            {
                elems.prettyPhoto();
            }
    }

    Any suggestions for what I might be doing wrong?

    Thanks

    https://wordpress.org/plugins/wp-video-lightbox/

Viewing 1 replies (of 1 total)
  • Thread Starter abbm

    (@abbm)

    Okay, I have figured it out. For those who are interested, this is the simplest (not necessarily most elegant) way to get it working:

    In ajax-load-more.min.js, find the following code:

    if ($.isFunction($.fn.almComplete)){$.fn.almComplete(alm);}

    After that code, add the following:

    $("a[rel^=\"wp-video-lightbox\"]").prettyPhoto();

    Once you have it working you can figure out the best software engineering solution for your specific site.

Viewing 1 replies (of 1 total)
  • The topic ‘Links loaded through Ajax plugin don't get a lightbox’ is closed to new replies.