user2233765
user2233765

Reputation: 25

Link is clickable sometimes on page load, other times not clickable

I am building a website that is using Jquery and some fancy css to drive an image gallery on the front page.

The gallery is based off this tutorial: http://tympanus.net/codrops/2012/02/06/3d-gallery-with-css3-and-jquery/

This is my webpage I am having trouble with: http://www.apexdesignstudios.com/index.html

I modified the css and html to my own needs for the website and this is the code I have:

<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>

And then this overlay for when a thumbnail is clicked:

<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>

I omitted the rest of the overlay code which then repeats for the 16 images.

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%;
}

So if you load the page, you may notice that the front middle thumbnail is clickable and the 2 on its either side are not clickable. Upon refreshing the page a random number of times, the side thumbnails do become clickable. I am just having trouble figuring out where I went wrong...I think its within the CSS file somewhere (CSS file is a drafty/WIP) but I am still unsure.

Thanks for the input in advance! Pete

Upvotes: 1

Views: 1436

Answers (1)

Mitchell Layzell
Mitchell Layzell

Reputation: 3058

Your problem is because of the laying of your different elements, a quick fix to this problem would be to apply a z-index property of 98 to the class .dg-container in styles.css the number can be anything lower than 99 because you have set a z-index on the class .gallery-overlay to 99

CSS

.dg-container {
    width: 100%;
    height: 280px;
    position: relative;
    padding-top: 10px;
    z-index: 98;
}

Upvotes: 2

Related Questions