我做了一個簡單的div懸停控制,顯示和隱藏引入jQuery的單詞。jquery div隱藏和顯示,z-index問題和mouseover/mouseout問題
@Steve心動已經問一個問題,@patorjk回答我。謝謝他們。
但現在,我還有一些問題。
IE中的索引問題。如何在頂層製作
div.hover
?如果我在
div.hover
添加一些超鏈接,如何修改js代碼,因此,只有鼠標移出這兩個div.hover
和div.title
,div.hover
將隱藏的(我需要點擊鏈接)
謝謝許多。
我更新了我的代碼在這裏http://jsfiddle.net/3jGdm/1/
HTML
<div id="body">
<div id="main">
<div class="box">
<div class="title">1</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 1</p>
</div>
<div class="box">
<div class="title">2</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 2</p>
</div>
<div class="box">
<div class="title">3</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 3</p>
</div>
<div class="box">
<div class="title">4</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 4</p>
</div>
<div class="box">
<div class="title">5</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 5</p>
</div>
<div class="box">
<div class="title">6</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 6</p>
</div>
<div class="box">
<div class="title">7</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 7</p>
</div>
<div class="box">
<div class="title">8</div>
<div class="hover">this is number 1, when you hover to the box content, show <a href="">something</a> here.</div>
<p>Box 8</p>
</div>
</div>
</div>
CSS
*{margin:0;padding:0;border:0;}
#body{width:100%;height:100%;background-color:#fff;}
#main{width:800px;height:400px;margin:0 auto;background-color:#999;}
.box{float:left;width:180px;height:150px;margin:9px;border:1px solid #666;display:inline-block;position:relative;}
.title{font-size:32px;line-height:150px;text-align:center;}
.hover{display:none;position:absolute;width:300px;background-color:#9C9;border:1px solid #666;z-index:10;font-size: 16px;}
.oy .hover{right:0;}
p{text-align:center;background-color:#333;}
的jQuery
jQuery(document).ready(function(){
$('.box:nth-child(4n+4)').addClass('oy');
$(".title").mouseover(
function() {
$(this).parent('.box').children(".hover").show();
}),
$(".title").mouseout(
function() {
$(this).parent('.box').children(".hover").hide();
}
);
});
哪個實習生的版本(S) et Explorer展示''索引問題''? – thirtydot 2011-05-27 20:19:54
@thirtydot,亞當拉默已經回答了一個,在ie8中工作,但在ie6中沒有,你有什麼好主意嗎?謝謝。 – 2011-05-27 20:26:05