如何修改我的javascript脚本

How to amend my javascript script?

本文关键字:我的 javascript 脚本 修改 何修改      更新时间:2023-09-26

我有这个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;
}

如果你想让它在悬停时显示动画,就用这个代替:

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

你需要的是不同的选择器,然后动画"current"元素