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

javascript - The bounce effect in jquery is not working? - Stack Overflow

programmeradmin3浏览0评论

I'm having trouble getting my bounce effect to work when I click on an image using JQuery. It just won't bounce. I've provided my code below.

<script type="text/javascript" src="js/jquery.js"></script>

<a href="#"><img id="cog" src="images/icons/cog.png" alt="User Settings"/></a>

$(document).ready(function() {
    $("#cog").click(function() {
        $(this).effect("bounce", {times: 3}, 500);
    });
});

I'm having trouble getting my bounce effect to work when I click on an image using JQuery. It just won't bounce. I've provided my code below.

<script type="text/javascript" src="js/jquery.js"></script>

<a href="#"><img id="cog" src="images/icons/cog.png" alt="User Settings"/></a>

$(document).ready(function() {
    $("#cog").click(function() {
        $(this).effect("bounce", {times: 3}, 500);
    });
});
Share Improve this question edited Apr 13, 2011 at 3:03 jondavidjohn 62.5k21 gold badges120 silver badges159 bronze badges asked Apr 13, 2011 at 3:00 Dennis MartinezDennis Martinez 6,53211 gold badges53 silver badges70 bronze badges 2
  • what version of jquery are you running? – jondavidjohn Commented Apr 13, 2011 at 3:03
  • There is no "effect" function in standard jquery library. – Calvin Froedge Commented Apr 13, 2011 at 3:04
Add a ment  | 

2 Answers 2

Reset to default 6

That's because it's part of the jQuery UI package.

Try adding this line

<script src="http://ajax.googleapis./ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

Effects are part of jQueryUI, not jQuery.

发布评论

评论列表(0)

  1. 暂无评论