最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: undefined is not a function on using jQuery.lazy() - Stack Overflow

programmeradmin1浏览0评论

I'm trying to use the jQuery's delayed image loading plugin to lazy load my images. While trying to do so I'm getting the error Uncaught TypeError: undefined is not a function on the 2nd line of my code.

Here is my JS code

jQuery(document).ready(function() {
    jQuery("img.lazy").lazy({
        effect: "fadeIn",
        effectTime: 1500
    });
});

This script is placed at the bottom of my page in a JS file along with some of my other scripts.

I have the following scripts in my <head> and I've verified that the files are indeed linked properly.

<script type="text/javascript" src="/static/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-ui.js"></script>

I have tried most of the solutions given to this problem on SO but I haven't had any success.

I'm trying to use the jQuery's delayed image loading plugin to lazy load my images. While trying to do so I'm getting the error Uncaught TypeError: undefined is not a function on the 2nd line of my code.

Here is my JS code

jQuery(document).ready(function() {
    jQuery("img.lazy").lazy({
        effect: "fadeIn",
        effectTime: 1500
    });
});

This script is placed at the bottom of my page in a JS file along with some of my other scripts.

I have the following scripts in my <head> and I've verified that the files are indeed linked properly.

<script type="text/javascript" src="/static/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-ui.js"></script>

I have tried most of the solutions given to this problem on SO but I haven't had any success.

Share Improve this question asked Aug 13, 2014 at 18:53 Yin YangYin Yang 1,8063 gold badges28 silver badges48 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

jQuery lazy is a separate plugin, and is not available part of either jquery, or jquery-ui

You need to download and add a reference along with the rest of the jquery libraries

<script type="text/javascript" src="/static/js/jquery.lazy.min.js"></script>
发布评论

评论列表(0)

  1. 暂无评论