我有一个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. 悬停溢出div
- 2. 滚动时隐藏溢出
- 3. 溢出隐藏不工作悬停
- 4. 图像没有溢出隐藏:隐藏
- 5. 溢出隐藏自动滚动
- 6. 滚动悬停图像
- 7. jQuery可拖动div使溢出:隐藏页面滚动
- 8. 悬停在div上溢出-y滚动 - Internet Explorer
- 9. 溢出隐藏和滚动同时
- 10. jQuery滚动UL隐藏溢出
- 11. Blueprintjs表隐藏溢出-s滚动条
- 12. 制作溢出:隐藏不滚动
- 13. 溢出虚假滚动条:隐藏
- 14. 图像颜色悬停在溢出
- 15. 隐藏悬停图像的一部分
- 16. 悬停显示/隐藏图像标题
- 17. 隐藏div上悬停的div
- 18. 限制DIV高度与溢出:通过家长滚动使用溢出:隐藏
- 19. 有什么办法滚动div与溢出:隐藏
- 20. Css转换无法在滚动div的身体溢出:隐藏
- 21. 带有Javascript的可滚动内容与溢出Div:隐藏
- 22. textarea滚动条溢出并隐藏div边框
- 23. CSS:在悬停的同时隐藏div和显示图像?
- 24. 关于悬停,隐藏图像显示div
- 25. 相对父div中的两个绝对子div隐藏着溢出:隐藏,预计悬停在彼此之上
- 26. jQuery隐藏div使用悬停显示所有隐藏的div
- 27. ,同时隐藏滚动条和隐藏溢出触发事件
- 28. 防止溢出:隐藏裁剪图像
- 29. 溢出隐藏我的图像
- 30. 隐藏/取消隐藏图像使用jQuery的悬停
你能分享的jsfiddle? – 2012-07-23 20:31:30
向我们展示您的代码,您尝试过的。 – 2012-07-23 20:31:33