我有一个简单的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