动态加载内容的动画效果 - jQuery
$(function() {
$("a").hover(
function() {
$(this).animate({color: "blue"}, 400);
}, function() {
$(this).animate({color: "white"}, 400);
})
$(".left").fadeOut("slow").load("created.php").fadeIn("slow");
})
我希望来自created.php 页面的链接(a's)具有悬停效果。我该怎么做呢?
$(function() {
$("a").hover(
function() {
$(this).animate({color: "blue"}, 400);
}, function() {
$(this).animate({color: "white"}, 400);
})
$(".left").fadeOut("slow").load("created.php").fadeIn("slow");
})
I want the links (a's) from the created.php page to have the hover effect. How can I do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
live
绑定处理程序。这样,页面中加载的任何新“a”也将获得悬停效果。注意:对于
live
,hover
仅需要一个处理程序。另一种方法是指定mouseenter
和mouseleave
处理程序。Use
live
to bind handlers. That way, any new 'a' loaded in the page will also get the hover effect.Note: With
live
,hover
takes only one handler. Alternative is to specifymouseenter
andmouseleave
handlers.您想要使用 jquery live 方法。
You want to use the jquery live method.