我重複下面的代碼。div的jquery循環
<div class="background1"></div>
<i class="fa fa-share" alt="share" title="Share"></i>
<div class="large1">
<div class="ttip">
<div>Here goes contents...</div>
<span class="note">(click here to close the box)</span>
</div>
</div>
我想顯示與類large1和背景的div。這是code(不是我的,在網上發現的)重複。
我試着做下面在第一單擊Java腳本
$('.fa-share').click(function(){
$(this).next(".large1").first().html(function() {
$(this).prev(".background1").css({"opacity": "0.3"}).fadeIn("slow");
$(this).next('.ttip').css({left: $(this).position() + '20px',top: $(this).position() + '50px'}).show(500)
}).fadeIn("slow");
$(this).next('.note').on('click', function() {
$(this).prev('.ttip').hide(500);
$(this).prev(".background1").fadeOut("slow");
$(this).prev(".large1").fadeOut("slow");
});
});
使用我曾嘗試「每()」,但沒有奏效。提前致謝。
'.large1'是不是你的'i'的孩子 - 而不是'find'嘗試'。接下來(」 large1" )'' – tymeJV 2014-09-30 23:55:04
搜索.next'兄弟姐妹嗎?但在我的情況下,這些不是兄弟姐妹。 – batmaniac7 2014-10-01 00:01:56
在你的例子中看起來像我的兄弟姐妹 – 2014-10-01 00:02:21