我有一個div與溢出:汽車和一張桌子裏面。 div根據需要創建垂直滾動條。不過,我想要爲每行預覽懸停狀態。這意味着這個盤旋狀態Div將不得不超越包含div的邊界。我怎麼會這樣做溢出已經設置爲隱藏我的內容... z-index不會讓我逃避父母。懸停圖像滾動div(溢出:隱藏)
0
A
回答
0
由於它是一個垂直滾動條,因此您可以設置爲溢出-y:滾動而不是水平設置溢出。然後只要確保你的圖像只留下水平邊界(而不是垂直)。
接下來的時間,創建一個小提琴:http://jsfiddle.net/,我們可以幫你更快的:)
+0
不幸的是,我必須讓懸停狀態能夠離開水平和垂直邊界......你知道有一種方法可以做到嗎? – Darren 2012-07-25 13:11:29
0
使用position:absolute;
並設置z-index
爲您要溢出其容器的DIV可見值。
0
我最近解決了類似的問題,這應該幫助你:
https://stackoverflow.com/a/13383906/1063287
也看到相關的jsfiddle這裏:
http://jsfiddle.net/rwone/eeaAr/
HTML
<div id="wrapper">
<div id ="hbar_one"></div>
<div id="hbar_two"></div>
<div id="container_a">
<div id="container_b">
<div class="class1 class2 magic" data-unique-content=".hidden_db_data_div">
<img src="http://lorempixel.com/g/50/50/">
<div class="hidden_db_data_div">
some amazing html
</div>
</div>
<div class="class1 class2 magic" data-unique-content=".hidden_db_data_div">
<img src="http://lorempixel.com/g/50/50/">
<div class="hidden_db_data_div">
more amazing html
</div>
</div>
<div class="class1 class2 magic" data-unique-content=".hidden_db_data_div">
<img src="http://lorempixel.com/g/50/50/">
<div class="hidden_db_data_div">
even more amazing html
</div>
</div>
</div>
</div>
<div id="hbar_three"></div>
<div id="hbar_four"></div>
</div>
CSS
#wrapper {
width: 300px;
}
#hbar_one {
background: #cc0000;
height: 50px;
}
#hbar_two {
background: #ffcc00;
height: 50px;
}
#container_b {
height: 100px;
overflow-y: auto;
}
.hidden_db_data_div {
display: none;
background: #00AFF0;
width: 120px;
height: 150px;
color: red;
position:absolute;
overflow: hidden;
z-index: 999;
}
img {
width: 50px;
height: 50px;
}
.magic {
display: inline;
}
#container_a { position:relative; }
#hbar_three {
background: #cccccc;
height: 50px;
}
#hbar_four {
background: #000000;
height: 50px;
}
腳本
$(".magic").hover(
function() {
$(this)
.find('.hidden_db_data_div')
.css({'left':$(this).position().left+20 + "px", 'top':'-20px'})
.fadeIn(200);
},
function() {
$(this)
.find('.hidden_db_data_div')
.fadeOut(100);
}
);
相關問題
- 1. 溢出:隱藏;圖像滾動
- 2. 滾動div內隱藏溢出div
- 3. 滾動,如果div被溢出隱藏
- 4. 懸停溢出div
- 5. 滾動時隱藏溢出
- 6. 溢出:隱藏 - 滾動
- 7. 溢出滾動已隱藏溢出
- 8. 如何隱藏滾動(溢出:隱藏)?
- 9. 溢出隱藏不工作懸停
- 10. 如何隱藏css溢出div的滾動條而不使用溢出:隱藏?
- 11. 圖像沒有溢出隱藏:隱藏
- 12. 圖像不溢出:隱藏
- 13. 如何滾動較大的div溢出:我隱藏的div
- 14. Div與滾動條裏面div與溢出:隱藏
- 15. 溢出隱藏自動滾動
- 16. 滾動懸停圖像
- 17. jQuery可拖動div使溢出:隱藏頁面滾動
- 18. Div隱藏在包含div滾動條溢出的下方:滾動集
- 19. 懸停在div上溢出-y滾動 - Internet Explorer
- 20. 滾動時隱藏div並在鼠標懸停時顯示它
- 21. 溢出隱藏和滾動同時
- 22. 製作溢出:隱藏不滾動
- 23. Blueprintjs表隱藏溢出-s滾動條
- 24. 溢出虛假滾動條:隱藏
- 25. jQuery滾動UL隱藏溢出
- 26. 溢出:隱藏移動div內
- 27. CSS DIV溢出隱藏和浮動
- 28. DIV溢出滾動停止短
- 29. 圖像顏色懸停在溢出
- 30. 將鼠標懸停另一圖像隱藏動畫圖像
你能分享的jsfiddle? – 2012-07-23 20:31:30
向我們展示您的代碼,您嘗試過的。 – 2012-07-23 20:31:33