1

我正在建立一个网站,它使用 Jquery 和一些花哨的 css 来驱动首页上的图片库。

该画廊基于本教程: http ://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/

这是我遇到问题的网页:http: //www.apexdesignstudios.com/index.html

我根据自己对网站的需要修改了 css 和 html,这是我拥有的代码:

<div class="content-bg">
<div class="container_16" id="content">
    <div id="dg-container" class="dg-container">
    <div class="dg-wrapper">
    <a href="#image-1"><img src="thumbs/1.jpg" alt="image01"></a>
    <a href="#image-2"><img src="thumbs/2.jpg" alt="image02"></a>
    <a href="#image-3"><img src="thumbs/3.jpg" alt="image03"></a>
    <a href="#image-4"><img src="thumbs/4.jpg" alt="image04"></a>
    <a href="#image-5"><img src="thumbs/5.jpg" alt="image05"></a>
    <a href="#image-6"><img src="thumbs/6.jpg" alt="image06"></a>
    <a href="#image-7"><img src="thumbs/7.jpg" alt="image07"></a>
    <a href="#image-8"><img src="thumbs/8.jpg" alt="image08"></a>
    <a href="#image-9"><img src="thumbs/9.jpg" alt="image09"></a>
    <a href="#image-10"><img src="thumbs/10.jpg" alt="image10"></a>
    <a href="#image-11"><img src="thumbs/11.jpg" alt="image11"></a>
    <a href="#image-12"><img src="thumbs/12.jpg" alt="image12"></a>
    <a href="#image-13"><img src="thumbs/13.jpg" alt="image13"></a>
    <a href="#image-14"><img src="thumbs/14.jpg" alt="image14"></a>
    <a href="#image-15"><img src="thumbs/15.jpg" alt="image15"></a>
    <a href="#image-16"><img src="thumbs/16.jpg" alt="image16"></a>
    </div>
<nav> 
    <span class="dg-prev"><</span>
    <span class="dg-next">></span>
</nav>
    </div>                   
</div>

然后是单击缩略图时的叠加层:

<div class="gallery-overlay" id="image-1">
            <img src="images/1.jpg"/>
                <div>
                    <h3><img src="images/apex.png"/></h3>
                    <p>Aureus Evolution Proof<br>by Gabor Mechtler</p>
                </div>
                <a href="#page" class="gallery-close">CLOSE</a>
        </div>
        <div class="gallery-overlay" id="image-2">
            <img src="images/2.jpg"/>
                <div>
                    <h3><img src="images/apex.png"/></h3>
                    <p>BFX Proof<br>by Gabor Mechtler</p>
                </div>
                <a href="#page" class="gallery-close">CLOSE</a>
        </div>

我省略了覆盖代码的其余部分,然后重复 16 幅图像。

CSS:

.dg-container
{
width: 100%;
height: 280px;
position: relative;
padding-top: 10px;
}
.dg-wrapper
{
width: 300px;
height: inherit;
margin-left: auto;
margin-right: auto;
position: relative;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
-ms-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;
-ms-perspective: 1000px;
perspective: 1000px;
}

.dg-wrapper a
{
width: inherit;
height: inherit;
display: block;
position: absolute;
left: 0;
top: 0;
}

.dg-wrapper a.dg-transition
{
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.dg-wrapper a img
{
display: block;
margin-left: auto;
margin-right: auto;
padding: 5px 0px 2px 0px;
}
.dg-wrapper a div
{
font-style: italic;
text-align: center;
margin-top: 2%;
text-shadow: 1px 1px 1px rgba(255,255,255,0.5);
color: #333;
font-size: 16px;
width: 100%;
display: none;
position: absolute;
}

.dg-wrapper a.dg-center div
{
display: block;
}
.dg-container nav
{
width: 80px;
height: 50px;
position: relative;


margin-left: auto;
margin-right: auto;

}
.dg-container nav span
{
text-indent: -9000px;
float: left;
cursor:pointer;
width: 35px;
height: 40px;
opacity: 0.8;
background: transparent url(../images/arrows.png) no-repeat top left;
padding-bottom: 10px;
}
.dg-container nav span:hover
{
opacity: 1;
}
.dg-container nav span.dg-next
{
background-position: top right;
margin-left: 10px;
}


.gallery-overlay
{
width: 0px;
height: 0px;
position: fixed;
overflow: hidden;
left: 0px;
top: 0px;
padding: 0px;
z-index: 99;
text-align: center;
background: rgb(0,0,0);
/* background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%, rgba(241,210,194,1) 100%);
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(255,255,255,0.56)), color-stop(100%,rgba(241,210,194,1)));
background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%);
background: radial-gradient(center, ellipse cover, rgba(255,255,255,0.56) 0%,rgba(241,210,194,1) 100%); */
}

.gallery-overlay > div
{
position: relative;
color: rgba(27,54,81,0.8);
width: 550px;
height: 80px;
margin: 40px auto 0px auto;
text-shadow: 0px 1px 1px rgba(255,255,255,0.6);
}

.gallery-overlay div h3,
.gallery-overlay div p
{
padding: 0px 20px;
width: 200px;
height: 60px;
}
.gallery-overlay div h3
{
float: left;
border-right: 1px solid #0090ff;
}
.gallery-overlay div h3 span,
.gallery-overlay div p
{
color: #FFFFFF;
font-family: Constantia, Palatino, "Palatino Linotype", "Palatino LT STD", Georgia, serif;
}
.gallery-overlay div h3 span
{
display: block;
line-height: 6px;
}
.gallery-overlay div p
{
font-size: 1.25em;
text-align: right;
float: left;

}
.gallery-overlay a.gallery-close
{
z-index: 1001;
color: #F00;
position: absolute;
top: 50px;
left: 50%;
font-size: 1.5em;
line-height: 25px;
text-align: center;
width: 70px;
height: 25px;
overflow: hidden;
margin-left: -25px;
opacity: 0; /* filter: alpha(opacity=0); /* internet explorer */
/* -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"; /*IE8*/
/* -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
box-shadow: 0px 1px 2px rgba(0,0,0,0.3); */
}
.gallery-overlay img
{
/* height: 100%; For Opera max-height does not seem to work */
max-height: 100%;
position: relative;
opacity: 0;
filter: alpha(opacity=0); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"; /*IE8*/
-webkit-box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
-moz-box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
box-shadow: 0px 2px 7px rgba(0,0,0,0.2);
-webkit-transition: opacity 0.5s linear;
-moz-transition: opacity 0.5s linear;
-o-transition: opacity 0.5s linear;
-ms-transition: opacity 0.5s linear;
transition: opacity 0.5s linear;
}

.gallery-overlay:target 
{
width: auto;
height: auto;
bottom: 0px;
right: 0px;
padding: 80px 100px 120px 100px;
}
.gallery-overlay:target img,
.gallery-overlay:target a.gallery-close
{
opacity: 1;
filter: alpha(opacity=99); /* internet explorer */
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=99)"; /*IE8*/
}
/* 
100% Height for Opera as the max-height seems to be ignored, not optimal for large screens 
http://bricss.net/post/11230266445/css-hack-to-target-opera 
*/
x:-o-prefocus, .gallery-overlay img 
{
height: 100%;
}

因此,如果您加载页面,您可能会注意到前面中间的缩略图是可点击的,而其两侧的 2 是不可点击的。随机刷新页面次数后,侧面缩略图确实变得可点击。我只是无法弄清楚我哪里出错了......我认为它在某处的 CSS 文件中(CSS 文件是草稿/WIP),但我仍然不确定。

感谢您提前输入!皮特

4

1 回答 1

2

你的问题是因为你的不同元素的放置,一个快速解决这个问题的方法是将z-index98 的属性.dg-container应用于styles.css数字可以低于 99 的类,因为你已经将z-index类设置.gallery-overlay为 99

CSS

.dg-container {
    width: 100%;
    height: 280px;
    position: relative;
    padding-top: 10px;
    z-index: 98;
}
于 2013-04-01T22:48:30.150 回答