• Resolved DopinPanda

    (@dopinpanda)


    anyone can help me at least disable the lazy load for iphone? cause all the images below the current view get grey.
    thanks. i’ve been reading and no one has an answer, so at least it would be great if someone can help me with jquery code to disable for iphone, and where to put it. thanks in advance

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

    (@dopinpanda)

    OK!!
    this code worked for me, hope for u too.
    ——————————————————

    <?php
    
      /*
      Plugin Name: jQuery lazy load plugin
      Plugin URI: https://github.com/ayn/wp-jquery-lazy-load/
      Description: a quick and dirty wordpress plugin to enable image lazy loading.
      Version: v0.10
      Author: Andrew Ng
      Author URI: https://blog.andrewng.com
      */
    
    function jquery_lazy_load_headers() {
      $plugin_path = plugins_url('/', __FILE__);
      $lazy_url = $plugin_path . 'javascripts/jquery.lazyload.mini.js';
      $jq_url = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
      wp_deregister_script('jquery');
      wp_enqueue_script('jquery', $jq_url, false, '1.4.2');
      wp_enqueue_script('jquerylazyload', $lazy_url, 'jquery', '1.5.0');
    }
    
    function 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;
    if (navigator.platform == "iPhone") return;
      jQuery("img").lazyload({
        effect:"fadeIn",
       threshold : 200,
        placeholder: "$placeholdergif"
      });
    });
    </script>
    EOF;
    }
    
      add_action('wp_head', 'jquery_lazy_load_headers', 5);
      add_action('wp_head', 'jquery_lazy_load_ready', 12);
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘jQuery Image Lazy Load WP disable for iphone’ is closed to new replies.