简体   繁体   English

Fancybox落后于导航菜单

[英]Fancybox goes behind navigation menu

I have the following div structure 我有以下div结构

<div class="page">
     <div id="top" class="header-container">
         <!-- navigation menu and search box in here -->
     </div>
     <div class="main-container col1-layout">
         <!-- Fancybox for photo gallery and onther content in here -->
     </div>
</div>

When my page is scrolled all the way to the top (normal loading position of the page) my Fancybox goes behind the navigation menu, but when I scroll down the page this issue is solved. 当我的页面一直滚动到顶部(页面的正常加载位置)时,我的Fancybox位于导航菜单的后面,但是当我向下滚动页面时,此问题已解决。

How can I do to overlay the Fancybox on top of the navigation menu? 如何在导航菜单顶部覆盖Fancybox? I'm using jquery.fancybox-1.3.4.js 我正在使用jquery.fancybox-1.3.4.js

Thanks 谢谢

try to set the css property z-index in one class of the menu and of the fancybox div: 尝试在菜单和fancybox div的一个类中设置css属性z-index

.header-container {
    z-index: 1;
}

.main-container {
    z-index: 2;
}

Elements which should be on top of others must have a greater z-index . 应该位于其他元素之上的元素必须具有更大的z-index

Increase z-index of fancybox element. 增加fancybox元素的z-index。 This may help 这可能会有所帮助

Like other answers suggest z-index is what you need to implement. 像其他答案一样,您需要实现z-index。

But to use z-index you need to apply position:relative; 但是要使用z-index,您需要应用position:relative; (or position:absolute;) for it to work. (或位置:绝对;)使其正常工作。

Thank you all. 谢谢你们。 z-index + position relative solved my problem! z-index +位置相对解决了我的问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM