我在wordpress上创建了一个博客,必须制作一个动态的帖子。我做了这个
<div class="box">
<span class="hide">Hide</span>
<span class="share" style="display:none">Show</span>
</div>
<div class="box">
<span class="hide">Hide</span>
<span class="share" style="display:none">Show</span>
</div>
<div class="box">
<span class="hide">Hide</span>
<span class="share" style="display:none">Show</span>
</div>
<div class="box">
<span class="hide">Hide</span>
<span class="share" style="display:none">Show</span>
</div>
<div class="box">
<span class="hide">Hide</span>
<span class="share" style="display:none">Show</span>
</div>
<div class="box">
<span class="hide">Hide</span>
<span class="share" style="display:none">Show</span>
</div>
<scritp>
$( ".box" ).hover(
function() {
$(".hide").hide();
$(".share").show();
}, function() {
$(".hide").show();
$(".share").hide();
});
</script>
.hide, .share {
display:block;
background-color: #A85BA5;
padding: 30px;
margin-bottom: 30px;
color: #fff;
text-align: center;
}
这是一个不起作用的示例http://jsfiddle.net/s59bu5xn/8/,我只想在显示上更改隐藏一项。这个博客主页上没有全球所有项目。
祝你好运, 中号
答案 0 :(得分:1)
试试这个
$( ".box" ).hover(
function() {
$(this).find(".hide").hide();
$(this).find(".share").show();
}, function() {
$(this).find(".hide").show();
$(this).find(".share").hide();
});
的 JSFIDDLE 强>