Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery plugins 在jQuery循环幻灯片上方的z索引处显示div_Jquery Plugins_Z Index_Cycle - Fatal编程技术网

Jquery plugins 在jQuery循环幻灯片上方的z索引处显示div

Jquery plugins 在jQuery循环幻灯片上方的z索引处显示div,jquery-plugins,z-index,cycle,Jquery Plugins,Z Index,Cycle,我在这里使用的是: 幻灯片位于相对定位的div中,其中包含一个绝对定位的div,用于保存标题。这个div位于循环图像的上方,但无论我给标题div设置了什么z索引,图像都会隐藏它 有没有办法让我的标题div位于循环图像上方 #homeslides { margin:0 auto; width:985px; height:420px; overflow:hidden; position:relative; padding-top:12px; } #h

我在这里使用的是:

幻灯片位于相对定位的div中,其中包含一个绝对定位的div,用于保存标题。这个div位于循环图像的上方,但无论我给标题div设置了什么z索引,图像都会隐藏它

有没有办法让我的标题div位于循环图像上方

#homeslides {
    margin:0 auto;
    width:985px;
    height:420px;
    overflow:hidden;
    position:relative;
    padding-top:12px;
}

#homeslideCaptions {
    position:absolute;
    bottom:0;
    width:907px;
    height:57px;
    z-index:2000000;
    background:rgba(0,0,0,0.5);
}
答案在这里:

字幕div在幻灯片容器中…作为一个孩子将被视为幻灯片


需要一个外包装为您的幻灯片…位置相对,然后位置字幕内。循环将使幻灯片z-index增加1,因此z-index至少比幻灯片计数多一个将起作用

我也遇到了这个问题

我的情况是,我的顶部下拉菜单项将始终包含在第2周期幻灯片中。我们知道通常在一个绝对块中有下拉菜单。无论何时单击或悬停,子菜单项都会显示出来。但同时,我们知道,它们不会被计入浮动布局,高度为0

以前,我试图设置容器div的相对位置,但一旦设置了,每当下拉子菜单出现时,顶部菜单下方的滑块就会被按下。显然,这不是我想要的

在研究周期2几个小时后,我发现了以下解决方案:

.cycle-slideshow {
 z-index: 0; // or any smaller value to the covered div's
}
其实很简单

好的,让我跟你分享更多

在Cycle2JS中,我们可以发现,默认情况下,Cycle2将主幻灯片项z-index初始化为maxZ:100

// @see: http://jquery.malsup.com/cycle2/api
$.fn.cycle.defaults = {
    ....
    maxZ:             100,
    ...
}
所有其他幻灯片的z索引都会增加-1,比如99、98等等

你可能会想,好吧,如果我把我的divz指数设置为101或更大,它将位于第二周期幻灯片的顶部。没错,但正如前面所说,我们必须将其定位为相对