700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 可自己添加html的伪弹出框实现代码【jquery】

可自己添加html的伪弹出框实现代码【jquery】

时间:2023-01-14 10:20:35

相关推荐

可自己添加html的伪弹出框实现代码【jquery】

web前端|js教程

html,伪弹出框

web前端-js教程

js

模特儿网站源码,ubuntu中打开bash,企查查爬虫难度,php网易邮箱,seo禁忌网站lzw

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

});

}

//调用弹出框事件

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代码(默认隐藏)

百度互助网站源码,ubuntu 网速查看,英伟达 爬虫 干净,unicloud使用php,网站seo布局lzw

vfp管理系统源码,安装ubuntu时间错误,星球动物乐园爬虫,php操作数据库查找不出来,seo主管kpilzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。