在wordpress中使用jQuery图片延迟加载插件时,可能会报出$(...).lazyload is not a function的错误。javascript
用wordpress的朋友们常常会用到各类插件,其中不少插件是基于jQuery的,形成这样的冲突在所不免。java
解决这类问题方法简单归纳为:在使用jQuery类时使用jQuery,在使用函数时使用$符号.jquery
而关于lazyload的问题,应该这样解决:wordpress
<script type="text/javascript" src="http://jileiba.com/wp-includes/js/jquery/jquery.min.js"></script> <script type="text/javascript" src="http://jileiba.com/wp-includes/js/jquery/jquery.lazyload.js"></script> <script type="text/javascript"> jQuery(document).ready(function ($) { $("img").lazyload({ placeholder: "http://jileiba.com/wp-includes/images/loading03.gif", effect: "fadeIn" }); }); </script>
End.函数