最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

可自己添加html的偽彈出框?qū)崿F(xiàn)代碼

 更新時間:2013年09月08日 16:18:46   作者:  
本文為大家介紹下html偽彈出框的實現(xiàn),感興趣的朋友可以了解下
js
復制代碼 代碼如下:

var popupStatus = 0;
//loading popup with jQuery magic!
function loadPopup(){
//loads popup only if it is disabled
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact").fadeIn("slow");
popupStatus = 1;
}
}
//disabling popup with jQuery magic!
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$("#backgroundPopup").fadeOut("slow");
$("#popupContact").fadeOut("slow");
popupStatus = 0;
}
}
//centering popup
function centerPopup(){
//request data for centering
var browser=navigator.userAgent;
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var stop="";
var sleft="";
if(browser.indexOf('Chrome')!=-1){
stop=document.body.scrollTop;
sleft=document.body.scrollLeft;
}
else{
stop=document.documentElement.scrollTop;
sleft=document.documentElement.scrollLeft;
}
// windowWidth+=document.body.scrollLeft;
// windowHeight+=document.body.scrollTop;
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
//centering
$("#popupContact").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2+stop,
"left": windowWidth/2-popupWidth/2+sleft
});
//only need force for IE6
//背景色
$("#backgroundPopup").css({
"height": windowHeight
});
}
//調(diào)用彈出框事件
function bb(str){
$("#download").show();
centerPopup();
loadPopup();
//CLOSING POPUP
//Click the x event!
$("#popupContactClose").click(function(){
disablePopup();
});
//Click out event!,點擊背景事件
$("#backgroundPopup").click(function(){
disablePopup();
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});
}

html代碼(默認隱藏)
復制代碼 代碼如下:

<div id="download" style="display: none;">
<div id="popupContact">
<!--自己的 HTML(body中)-->
</div>
<div id="backgroundPopup"></div>
</div>
</div>

相關文章

最新評論

珲春市| 中卫市| 安达市| 民乐县| 土默特右旗| 海淀区| 大埔区| 武定县| 渝北区| 上饶市| 遂昌县| 黔东| 萨嘎县| 祁东县| 嵊州市| 保德县| 通渭县| 噶尔县| 闽清县| 兰坪| 鄂州市| 双城市| 南川市| 玉环县| 剑川县| 宁城县| 新丰县| 石台县| 洛隆县| 廊坊市| 衡东县| 类乌齐县| 高州市| 桓仁| 中牟县| 泸西县| 高尔夫| 榆树市| 井冈山市| 浦县| 阿拉尔市|