我有这个javascript:http://www.mastermind-solutions.com/wp-content/uploads/2008/07/jquery-popup-bubble/index.html
这是html:
<div class="rss-popup">
<a href="feed-link" id="rss-icon">RSS Feed</a>
<em>Subscribe to our RSS Feed</em>
</div>
我需要的是将这个jquery动画放在没有链接的简单div上。我需要制作动画的html:<span class="tickercontainer" id="votes<?php the_ID(); ?>"><?php echo $votes; ?></span>
我应该如何修改此效果以使其适用于我的情况?
的javascript:
$(document).ready(function(){
$(".rss-popup a").hover(function() {
$(this).next("em").stop(true, true).animate({opacity: "show", top: "-60"}, "slow");
}, function() {
$(this).next("em").animate({opacity: "hide", top: "-70"}, "fast");
});
});
的CSS:
div.rss-popup em {
background: url("images/bubble.png") no-repeat;
width: 100px;
height: 49px;
position: absolute;
top: -70px;
left: -0px;
text-align: center;
text-indent: -9999px;
z-index: 2;
display: none;
}
.rss-popup {
margin: 100px auto;
padding: 0;
width: 100px;
position: relative;
}
#rss-icon {
width: 42px;
height: 42px;
background: url("images/icon.png") no-repeat 0 0;
text-indent: -9999px;
margin: 0 auto;
display: block;
}
答案 0 :(得分:0)
如果你想在悬停时动画,请改为:
$(document).ready(function(){
$(".tickercontainer").hover(function() {
$(this).stop(true, true).animate({opacity: "show", top: "-60"}, "slow");
}, function() {
$(this).animate({opacity: "hide", top: "-70"}, "fast");
});
});
您需要的是不同的选择器,然后为“当前”元素设置动画。