0
我試圖隱藏div .first隨時.second是可見的。現在我正在使用z-index來隱藏它們,但一直不成功。如何隨時隱藏.first。第二次出現?如何隱藏另一個可見的div?
CSS
.highlight {
opacity: 100;
z-index: -1;
}
.second {
z-index: 1;
}
HTML
<div class="toggleElements"> <!---AdServer--->
<div class="first" id="adserver_contain">
<div id="ad_server"><img class="highlight" src="Images/Adserver_roll.png"></div>
</div>
<div class="second" id="ad_serverb">
<img class="img-responsive" src="Images/Adserver.png">
<div id="ad_serverb_text"><h1>Ad Server</h1><p>
Ad servers aggregate data and provide a centralized reporting interface. This aggregate determines what publishers sites get what inventory. AdsNative is the only truly independent ad server.</p></div>
</div>
</div> <!---AdServer End--->
當前的Jquery
$(document).ready(function() {
$(".toggleElements").each(function() {
var parent = $(this);
$(this).find(".first").click(function() {
$(this).fadeToggle();
$(parent).find(".second").fadeToggle();
});
$(this).find(".second").click(function() {
$(this).fadeToggle();
$(parent).find(".first").fadeToggle();
});
});
});
*「我正在使用z-index隱藏」* - 爲什麼你使用z-index這個? – nnnnnn
我以爲我可以簡單地將圖像類轉換回來,所以如果不使用javascrpt –