2013-04-09 162 views
-1

我正在使用一個叫做fancybox的jQuery插件,用於我正在做的網站。它似乎有點小問題,因爲頂部頁面有一些不可見的疊加層,但它激活了頁面底部的縮略圖視圖,並且掩蓋了我的鏈接,並且毀掉了整個頁面。jQuery故障燈箱

網站的問題: http://johns-webdesign.com/client/Andy/gallery.html

HTML

<div id="content" style="height:350px"> 
     <h1>Our Work</h1> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction bathroom.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction bathroom.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction best windows.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction best windows.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction block.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction block.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction floors.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction floors.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction hygiene.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction hygiene.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction sanity.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction sanity.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/construction stair railings.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/construction stair railings.jpg" title="Test">Hi</a></div></div> 

<div class="photo_thumb"><a href="#"><img src="img/work/constructions stairs railings.jpg" width="160" height="100"></a><p>Title</p> 
<div class="overlay"><a class="fancybox" href="img/work/constructions stairs railings.jpg" title="Test">Hi</a></div></div> 


     </div> 

CSS

.photo_thumb { 
    height:100px; 
    width:160px; 
    float:left; 
    margin:4px 4px 15px 4px; 
    padding:5px; 
    background-color:#999; 
} 
.overlay { 
    height:100px; 
    width:160px; 
    display:none; 
    margin-top:-137px; 
    background-color:#666; 
    opacity:0.5; 
    background-position:center; 
    background-image:url(../img/zoom.png); 
    background-repeat:no-repeat; 
    background-position: 1 0; 
} 
.photo_thumb:hover > .overlay { 
    position:relative; 
    z-index:2; 
    display:block; 
    opacity:0.6; 
    background-position:center; 
    background-color:#666; 
    height:100px; 
    width:160px; 
    opacity:0.5; 
} 
.photo_thumb p { 
    margin-top:3px; 
    margin-left:-20px; 
} 
.overlay a{ 
    position:absolute; 
    width:100%; 
    height:100%; 
    top:0; 
    left:0; 
    text-decoration:none; /* Makes sure the link doesn't get underlined */ 
    z-index:10; /* raises anchor tag above everything else in div */ 
    background-color:white; /*workaround to make clickable in IE */ 
    opacity: 0; /*workaround to make clickable in IE */ 
    filter: alpha(opacity=1); /*workaround to make clickable in IE */ 
} 
.fancybox { 
    display:none; 
} 

我現在,因爲它是不接受的工作已在的fancybox的顯示設置爲none。以下是我經歷過的一些事情;

.overlay > .fancybox { 
display:block; 
} 

這並沒有解決這個問題,所以我嘗試了一些JavaScript

<script type="text/javascript"> 
    $('.overlay').hover(function() { 
    $('.fancybox').toggle(show)(); 
}); 
    </script> 

這出於某種原因沒有做的事情。

我很難相信。

回答

0
<script type="text/javascript"> 
    $(document).ready(function(){ 
    $('.overlay').hover(function() { 
    $('.fancybox').toggle()(); 
    }); 
}); 
</script> 

修復了這個問題。感謝評論但刪除了他的帖子的人,它解決了這個問題,但我只是從toggle()中刪除了屬性hide()