jQuery怎么实现弹出窗口弹出div层
发表于:2024-10-21 作者:千家信息网编辑
千家信息网最后更新 2024年10月21日,这篇文章主要介绍了jQuery怎么实现弹出窗口弹出div层的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇jQuery怎么实现弹出窗口弹出div层文章都会有所收获,下面我们
千家信息网最后更新 2024年10月21日jQuery怎么实现弹出窗口弹出div层
这篇文章主要介绍了jQuery怎么实现弹出窗口弹出div层的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇jQuery怎么实现弹出窗口弹出div层文章都会有所收获,下面我们一起来看看吧。
jQuery代码:
$(function(){ var screenwidth,screenheight,mytop,getPosLeft,getPosTop screenwidth = $(window).width(); screenheight = $(window).height(); //获取滚动条距顶部的偏移 mytop = $(document).scrollTop(); //计算弹出层的left getPosLeft = screenwidth/2 - 260; //计算弹出层的top getPosTop = screenheight/2 - 150; //css定位弹出层 $("#box").css({"left":getPosLeft,"top":getPosTop}); //当浏览器窗口大小改变时... $(window).resize(function(){ screenwidth = $(window).width(); screenheight = $(window).height(); mytop = $(document).scrollTop(); getPosLeft = screenwidth/2 - 260; getPosTop = screenheight/2 - 150; $("#box").css({"left":getPosLeft,"top":getPosTop+mytop}); }); //当拉动滚动条时... $(window).scroll(function(){ screenwidth = $(window).width(); screenheight = $(window).height(); mytop = $(document).scrollTop(); getPosLeft = screenwidth/2 - 260; getPosTop = screenheight/2 - 150; $("#box").css({"left":getPosLeft,"top":getPosTop+mytop}); }); //点击链接弹出窗口 $("#popup").click(function(){ $("#box").fadeIn("fast"); //获取页面文档的高度 var docheight = $(document).height(); //追加一个层,使背景变灰 $("body").append(""); $("#greybackground").css({"opacity":"0.5","height":docheight}); return false; }); //点击关闭按钮 $("#closeBtn").click(function() { $("#box").hide(); //删除变灰的层 $("#greybackground").remove(); return false; }); });
html代码:
jquery pop up 关闭
关于"jQuery怎么实现弹出窗口弹出div层"这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对"jQuery怎么实现弹出窗口弹出div层"知识都有一定的了解,大家如果还想学习更多知识,欢迎关注行业资讯频道。
知识
代码
内容
篇文章
价值
大小
按钮
操作简单
文档
文章
易懂
更多
浏览器
看吧
背景
行业
资讯
资讯频道
链接
页面
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
玉林网络安全监察部门在哪
软件开发行业内幕
自有实体瘤数据库排序
云科技与互联网直播
重大节日网络安全保障报告
惠州市博源网络技术有限公司
盐城工控网络安全
暗黑2重制版链接不上服务器
软件开发成本要多少钱
服务器音频文件
数据库视图不删会显示吗
服务器电脑配置使用
数据库条目文件更新记录
浪潮服务器信息安全市场
图数据库支持搜索
四川师范网络安全好不好
服务器跑dns
数据库交叉连接
文件放在数据库中
怎么配置联通机顶盒服务器信息
网络安全反诈骗心得体会
高校学生网络安全公约
时代光华软件开发有限公司
网络安全专家视频黑客
哪儿有语音对讲软件开发
网络安全手抄报简单又好画带句子
计算器网络技术钱途怎么样
互联网与科技论文
泰安网络安全保护
怎么解决csol无法连接服务器