2011-08-30 65 views
0

我有这个JavaScript:http://www.mastermind-solutions.com/wp-content/uploads/2008/07/jquery-popup-bubble/index.html如何修改我的JavaScript脚本?

这里的HTML:

<div class="rss-popup"> 
    <a href="feed-link" id="rss-icon">RSS Feed</a> 
    <em>Subscribe to our RSS Feed</em> 
</div> 

我需要的是得到一个简单的div这个jQuery的动画没有链接。我需要动画的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

如果你想它的动画悬停,正好有这个来代替:

$(document).ready(function(){ 
    $(".tickercontainer").hover(function() { 
    $(this).stop(true, true).animate({opacity: "show", top: "-60"}, "slow"); 
    }, function() { 
    $(this).animate({opacity: "hide", top: "-70"}, "fast"); 
    }); 
}); 

你需要的是不同的选择,然后动画“当前”元素。

+0

我试过了,它不正确。事实上,它所做的就是悬停.ticekrcontainer升起并消失。 – user919375

+0

您可能需要在您的'tickercontainer'类中应用相同的CSS。 –