下面是我使用的代碼。點擊不會點擊包裹在其他的div時
$(document).ready(function(){
$('.likeBtn').click(function() {
$(this).toggleClass('clicked');
});
});
它工作時,它只是單獨但是當我把它在當場我需要它,裏面約三個div不工作了,爲什麼?
你可以看到我在這裏想使用它:http://absdfsderedfdsfrr.tumblr.com/
CSS
.like_button {
width: 100%;
height: 100%;
position: absolute;
margin: 0;
top: 0;
left: 0;
opacity: 0;
}
.like_button iframe {
width: 100%;
height: 100%;
}
ul#meta li.likeBtn {
display: block;
width: 21px;
height: 20px;
position: relative;
background: url('http://static.tumblr.com/uiqhh9x/BPnlzww8v/like.png');
}
ul#meta li.clicked {
background: url('http://static.tumblr.com/uiqhh9x/Y36m6h0qu/liked.png')!important;
}
HTML(埋在的div雖然)
<ul id="meta">
<li class="likeBtn">{LikeButton color="grey" size="20"}</li>
</ul>
能否請你分享的影響div中的HTML和CSS? – Steve
http://absdfsderedfdsfrr.tumblr.com/ 您可以在左邊看到我正在嘗試更改的心臟 – user2726228
我想,在編輯主題模板時,您可能會從Tumblr API獲得一些幫助! –