新增功能点击-弹出新页面功能 封装,jquery实现,实用型..........
2019-05-17 12:17
393 查看
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>点击弹窗html</title> <style> *{margin: 0px;padding: 0px;} .and_page{ width: 100%; height: 100%; background: rgba(42,42,42,0.2); position:absolute;top: 0px; display: none } .and_page .and_page_all{ width: 800px; position: relative; top: 50%; left: 50%; margin-top: -270px; margin-left: -400px; border: 1px solid #99999936 } .and_page .and_page_all .and_page_content{ width: 100%; height: 30px; border-bottom: 1px solid #99999936; background: #FFFFFF; color: #666 } .and_page .and_page_all .and_page_content p{ float: left; font-size: 16px; line-height: 30px; margin-left: 10px } .and_page .and_page_all .and_page_content .close{ float: right; width: 16px; margin-right: 10px; line-height: 28px; text-align: center; font-size: 20px; background: #FFFFFF; cursor: pointer } .and_page .and_page_all .all_myIframe{ width:100%; height:500px; margin-top: 1px } </style> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <script> $(function(){ window.addWeb=function addWeb(title,url){ var andPage = $("<div class=\"and_page\"></div>"); var pageAll = $("<div class=\"and_page_all\"></div>"); var pageContent = $("<div class=\"and_page_content\"></div>"); var content_p = $("<p></p>"); content_p.text(title); var content_a = $("<a class=\"close\">×</a>"); var allMyIframe = $("<iframe class=\"all_myIframe\" id=\"myIframe\" src=\"\" frameborder=\"0\">"); allMyIframe.attr('src',url); content_p.appendTo(pageContent); content_a.appendTo(pageContent); allMyIframe.appendTo(pageContent); pageContent.appendTo(pageAll); pageAll.appendTo(andPage); andPage.appendTo('body'); andPage.fadeIn(); pageAll.delay(500).slideDown(); $(".close").click(function(){ $(".and_page").fadeOut(); }) } }) </script> </head> <body> <div class="box"> <input onclick="addWeb('韋小寳','https://toutiao.jxnews.com.cn/?from=dj38')" type="button" value="点击淡入弹窗" /> </div> </body> </html>
样式可自行修改,欢迎留言!
相关文章推荐
- jquery实现点击缩略图在弹出层显示原图功能
- 点击新增按钮,弹出对话框,并且对话框加载另外一个页面的内容的具体实现
- jQuery实现点击除了特定div的页面其它地方,隐藏该div功能。
- jquery实现checkbox全选功能,第二次点击【全选】按钮,页面无法勾选
- jquery实现点击信息弹出层的功能
- jQuery 怎么实现点击页面其他地方隐藏菜单? 做了个按钮点击时弹出菜单,想实现点击其他地方时隐藏弹出的菜单
- jquery注册事件 实现导航的功能,点击导航大分类弹出小分类
- jquery 点击页面其他地方实现隐藏菜单功能
- jQuery实现点击自身以外区域关闭弹出层功能完整示例【改进版】
- jQuery实现打开网页自动弹出遮罩层或点击弹出遮罩层功能示例
- jQuery实现页面点击后退弹出提示框的方法
- jquery 点击页面其他地方实现隐藏菜单功能
- jQuery插件--zTree中点击节点实现页面跳转时弹出两个页面的问题
- jquery实现点击进入新的页面。(jquery实现超链接)
- 原生js实现移动端的视频播放可拖拽小窗功能,点击小窗返回到原始页面
- jQuery操作dom实现弹出页面遮罩层(web端和移动端阻止遮罩层的滑动)
- jQuery弹出下拉列表插件(实现kindeditor的@功能)
- jQuery+css+html实现页面遮罩弹出框
- Jquery使用mouseenter和mouseleave实现鼠标经过弹出层且可以点击
- jQuery实现鼠标点击弹出渐变层的方法