开发者

Hover not working with jQuery Tools - jQuery [duplicate]

开发者 https://www.devze.com 2023-03-30 19:52 出处:网络
This question already has an answer here: Closed 10 years ago. Possible Duplicate: Hover not working with jQuery Tools - jQuery
This question already has an answer here: Closed 10 years ago.

Possible Duplicate:

Hover not working with jQuery Tools - jQuery

When I add jQuery Tools to my page, hover effect on links doesn't work. Witho开发者_开发百科ut it, it works.

<script src="jquery.js"></script>
<script src="http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js"></script>
<script src="jquery.color.js"></script>
<script>
$(function() {
    $(".header").live({ 
        mouseenter: function() {
            $(this).animate({color: "black"}, 400);
        }, 
        mouseleave: function() {
            $(this).animate({color: "white"}, 400);
        }
    });
});
</script>

Another question: does jQuery Tools tooltip work with jQuery live?

Err, I don't think you guys understood it.. it works when I don't add:

<script src="http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js"></script>


The problem is the syntax you are using for .live doesn't work in jQuery 1.4.2, it was added in jquery 1.4.3. try binding this way instead:

<script src="http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js"></script>
<script src="jquery.color.js"></script>
<script>
$(function() {
    $(".header").live('mouseenter mouseleave',function(e){ 
        $(this).animate({color: e.type === "mouseenter" ? "black" : "white" }, 400);
    });
});
</script>

EDIT

Also, the jquery tools is overriding your original jquery script include, that is why i omitted it.

0

精彩评论

暂无评论...
验证码 换一张
取 消