• Resolved rsanews

    (@rsanews)


    Hello jleuze,

    I’m experiencing a jquery conflict while using your plugin. I use https://plugins.jquery.com/project/lazyload across my entire site, which works wonderfully, only revealing images as users scroll to them. However, when I attempt to use Meteor Slides on one of my pages, only the first image of the slide sequence loads and the rest appear as gray boxes as they cycle through… because the lazyload plugin is waiting for the user to scroll. A user would have to nudge the scroll for every new images to get it to appear.

    I’m wondering if there is a code snippet I could use to disable lazyload on that particular page ONLY, and yet still allow Meteor Slides to work on that page.

    Because of the issue, I do not have the slideshow active on the site at the moment but could activate it if necessary.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Josh Leuze

    (@jleuze)

    Hi, I checked out Lazy Load and noticed that the developer has a notice up that “Lazy Load is currently not usable. It does not work with the latest browsers as expected”. Not that that is related to this issue exactly, but something to watch out for.

    It looks like you can exclude a certain container from being affected by Lazy Load, check out this post. So for you it might look like this:

    jQuery("div").not(".meteor-slides").find("img").lazyload

    Thread Starter rsanews

    (@rsanews)

    Syntax is not quite right. That line does kill lazyload, but for the entire site. Suggestions on how to tweak the line?

    Plugin Author Josh Leuze

    (@jleuze)

    I’ll have to test it and see. A lot of the examples I found were users who wanted to exclude Lazy Load from multiple areas like the footer and sidebar, so they were specifically targeting just the main content container with LL, would this be a possibility in your case?

    Thread Starter rsanews

    (@rsanews)

    I don’t mind having lazyload work in the footer and sidebar but if you’re experimenting with solutions to isolate it, I’d appreciate hearing what you come up with. Many thanks.

    Plugin Author Josh Leuze

    (@jleuze)

    I tested this out and wasn’t able to get the code to exclude a container to work either.

    I was able to get it to load just the content div in Twenty Ten with this code:

    $("#content img").lazyload();

    That would work if you are using the slideshow template tag or widget, but not with the shortcode.

    Thread Starter rsanews

    (@rsanews)

    That makes sense. In this case, I was using it with the shortcode, so I’ll just leave it as-is. My site is not too image-intensive, so lazyload is not a critical feature and I can live without it. Thank you for checking it out.

    Plugin Author Josh Leuze

    (@jleuze)

    You’re welcome, glad to help.

    Hi, I’m using Thematic theme framework wich has some filters and hooks.
    I wanted a Meteor Slideshow called “main” on my Front Page so I used this function:

    // Meteor Slideshow in Front Page
    function home_slideshow() {
    	if ( is_front_page() && function_exists( 'meteor_slideshow' ) ) {
    		meteor_slideshow("main");
    	}
    }
    add_action('thematic_abovecontent', 'home_slideshow');

    Notice that I put it “Above the Content DIV” with thematic_abovecontent() hook.

    Then I stepped with the Lazyload problem, so I override the plugin’s function with this one (you have to put this on your theme’s functions.php):

    // Custom Lazyload
    function custom_jquery_lazy_load_ready() {
      $placeholdergif = plugins_url('images/grey.gif', __FILE__);
      echo <<<EOF
    <script type="text/javascript">
    jQuery(document).ready(function($){
      if (navigator.platform == "iPad") return;
      jQuery("#header,#content,#primary,#secondary,#footer").find("img").lazyload({
        effect:"fadeIn",
        placeholder: "$placeholdergif"
      });
    });
    </script>
    EOF;
    }
    remove_action('wp_head', 'jquery_lazy_load_ready', 12);
    add_action('wp_head', 'custom_jquery_lazy_load_ready', 12);

    It works because my slideshow is not in the content. It would be better if I could just exclude the containers I want with “.not(this)” but I don’t know how to (I suck at javascript). Any clue?

    Thanks!

    Plugin Author Josh Leuze

    (@jleuze)

    Lazy Load isn’t being maintained and I don’t think you can get it to exclude certain containers, you have to specifically include the ones you want.

    Thank you JLeuze. ??

    function custom_jquery_lazy_load_ready() {
      $placeholdergif = plugins_url('jquery-image-lazy-loading/images/grey.gif');
      echo <<<EOF
    <script type="text/javascript">
    jQuery(document).ready(function($){
      if (navigator.platform == "iPad") return;
      jQuery("div").find('img:not(.attachment-featured-slide)').lazyload({
        effect:"fadeIn",
        placeholder: "$placeholdergif"
      });
    });
    </script>
    EOF;
    }
    remove_action('wp_head', 'jquery_lazy_load_ready', 12);
    add_action('wp_head', 'custom_jquery_lazy_load_ready', 12);

    Thank you @danmichel it works!
    although this one’s simpler:

    // Custom Lazyload
    function custom_jquery_lazy_load_ready() {
      $placeholdergif = plugins_url('jquery-image-lazy-loading/images/grey.gif');
      echo <<<EOF
    <script type="text/javascript">
    jQuery(document).ready(function($){
      if (navigator.platform == "iPad") return;
      jQuery("img:not('.attachment-featured-slide')").lazyload({
        effect:"fadeIn",
        placeholder: "$placeholdergif"
      });
    });
    </script>
    EOF;
    }
    remove_action('wp_head', 'jquery_lazy_load_ready', 12);
    add_action('wp_head', 'custom_jquery_lazy_load_ready', 12);

    Could not have done it without your sample.

    If you want to exclude multiple classes, coma separate them:

    // Custom Lazyload
    function custom_jquery_lazy_load_ready() {
      $placeholdergif = plugins_url('jquery-image-lazy-loading/images/grey.gif');
      echo <<<EOF
    <script type="text/javascript">
    jQuery(document).ready(function($){
      if (navigator.platform == "iPad") return;
      jQuery("img:not('.attachment-featured-slide','.my-class','#my-id')").lazyload({
        effect:"fadeIn",
        placeholder: "$placeholdergif"
      });
    });
    </script>
    EOF;
    }
    remove_action('wp_head', 'jquery_lazy_load_ready', 12);
    add_action('wp_head', 'custom_jquery_lazy_load_ready', 12);

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: Meteor Slides] jquery conflict’ is closed to new replies.