1
我正在创建一个简单的图片库。我的意思很简单:jQuery和Z-index问题
<div id="outerdiv" style="width:600px;height:400px; background:#ccc;padding:50px;">
<div id="theGallery">
<div class="thumbnailDiv" id="tn1">
<div style="position: absolute;">
<img id="1" src="pic1.jpg"/>
</div>
</div>
<div class="galleryButtonLeft"></div>
</div>
</div>
我想离开这样被点击galleryButtonLeft当其他图像可以显示图像滑动。继承人我的jQuery:
$(function() {
$(".galleryButtonLeft").mousedown(function (event) {
event.preventDefault();
$("#theGallery").animate({
marginLeft: "-=300px"
}, 1000);
}).click(function (event) {
event.preventDefault();
});});
而CSS:
.galleryButtonLeft
{
height:130px;
width:40px;
border:#996663 solid 1px;
background:#e9cbad;
z-index:30;
}
画廊向左滑动,但其唯一的背后隐藏着galleryButtonleft
DIV,而不是背后的outerdiv
DIV部分到我的按钮的左侧。该画廊的z-index
低于所有其他z-indexes
。那么我如何隐藏theGallery
,以便它不会显示在outerdiv
div上,除了galleryButtonLeft右侧的当前图像?
嗨,詹姆斯。感谢您的回应。如果你说的地方溢出:隐藏在“outerdiv”我以前试过,它没有工作。 – BoundForGlory 2012-02-13 22:13:03
“theGallery”是包装。 “theGallery”将包含我的所有图像,但一次只显示3个。我想向左滚动“theGallery”,以便下一组图像可以出现。 – BoundForGlory 2012-02-13 22:15:57
它可能会在'theGallery'上。像这样http://jsfiddle.net/6rHC2/2/ – 2012-02-13 22:17:32