狀況

2015-03-30 65 views
-2
<div class='head'> 
     <img class='img_plus'> <img class='img_minus'> 
</div> 
<div> div next head</div> 

使用效果基本show()和了slideDown()在手風琴,我想檢查下一個頭部的股利是向上滑動,就說明.img_plus(+)頭,否則,如果未來股利頭向下滑動,它隱藏(+),並顯示.img_minus( - )狀況

+1

請添加相關的JS/jQuery的當前已 – 2015-03-31 00:08:19

+1

好了,對不起,這是我第一次使用的網站,我剛剛簽署幾分鐘前 – 2015-03-31 00:16:19

回答

0
$(".head").each(function(){     // For each .head element 

    $(this).find("img").hide();    // Hide all icons first 
    var $nextDiv = $(this).next("div");  // Get the next DIV element 

    if($nextDiv.is(":visible")) {   // If next DIV is visible 
     $(this).find(".img_minus").show(); // Show the - icon 
    }else{         // Else 
     $(this).find(".img_plus").show();  // Show the + icon 
    } 

});