我有一個簡單的jQuery彈出。我有問題讓它工作。現在彈出窗口不顯示。實況網頁可在以下網址查看:http://www.domainandseo.com/fibro/index.htmljQuery彈出不工作 - 簡單的自定義彈出
如果向下滾動一下,會有一個鏈接顯示「點擊放大」,這會使彈出窗口顯示。
我的HTML是:
<div id="lightbox">
<a href="" class="cross close"><img src="img/cross.png" alt="X" /></a>
<img src="img/lightbox-img.jpg" alt="Supplemental Facts" class="lightbox-img" />
</div>
<div class="overlay"></div>
的CSS是:
#lightbox {
width: 722px;
height: 732px;
background: #FFF;
z-index: 1000;
position: absolute;
left: 250px;
top: 100px;
display: none;
}
.cross {
float: right;
}
.lightbox-img {
margin-left: 90px;
margin-top: 45px;
}
.overlay {
position: absolute;
top:0;
left:0;
bottom:0;
right:0;
width:100%;
height:130%;
z-index:998;
background: url(../img/gray.png) repeat;
display: none;
}
與jQuery的爲彈出:
$(document).ready(function(){
//open popup
$(".pop").click(function(){
$("#lightbox").fadeIn(1000);
$(".overlay").css ({display: 'block'});
positionPopup();
});
//close popup
$(".close").click(function(){
$("#lightbox").fadeOut(500);
$(".overlay").css ({display: 'none'});
});
});
//position the popup at the center of the page
function positionPopup(){
if(!$("#lightbox").is(':visible')){
return;
}
$("#lightbox").css({
});
}
//maintain the popup at center of the page when browser resized
$(window).bind('resize',positionPopup);
感謝的人..所以我想我的設置錨的名字彈出DIV會做一個很好的解決方案 –
或者完全移除錨點,將其更改爲段落元素或甚至是激活彈出窗口的div按鈕。 – samrap