jquery打造左侧跟随页面滚动的隐藏悬浮图层,当用户鼠标点击图层按钮后弹出显示图层居中显示,这个弹出的图层带关闭按钮。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>jquery实现左侧隐藏悬浮层特效_武鸣人</title> <style> body{text-align:center;font-size:12px;color:#333;font-family:"宋体";background:#fff;margin:0 auto;padding:0;} body > div{text-align:center;margin-right:auto;margin-left:auto;} div,form,ul,ol,li,span,p,dt,dd,dl{border:0;margin:0;padding:0;} img,a img{border:0;margin:0;padding:0;} h1,h2,h3,h4,h5,h6{font-size:12px;font-weight:400;margin:0;padding:0;} ul,ol,li{list-style:none;} td{word-break:break-all;} a{color:#003cc8;text-decoration:none;} a:hover{text-decoration:underline;color:blue;} .f_tahoma{font-family:Tahoma;} em,i{font-style:normal;} .askwwwwumingren{overflow:hidden;position:fixed;left:0px;top:200px;z-index:2} .left_wuming{background:red;width:20px;height:80px;text-align:center;line-height:20px;display:block;color:#fff; } .content{background:#999;width:800px;height:2000px;margin:0 auto} * html,* html body /* 修正IE6振动bug */{background-image:url(about:blank);background-attachment:fixed;} .askwwwwumingren{_position:absolute;_bottom:auto;_left:0;_top: expression(documentElement.scrollTop + 200 + "px");} .page_wwwwumingren{width:0px; position:absolute;height:0px;left:0;top:0px;z-index:1;overflow:hidden;display:none} .page_wwwwumingren div{border:1px solid #000;overflow:hidden;width:398px} .page_wwwwumingren h1{height:40px;text-align:center;font-size:20px;color:#fff;background:red;line-height:40px} .page_wwwwumingren h1 a{float:right;color:#000;margin-top:-15px} .page_wwwwumingren p{padding:10px;line-height:22px;font-size:14px;text-align:left;background:#fff;height:400px;width:378px} </style> <script type="text/javascript" src="/img/jquery_wuming_ren.js"></script> <script language="javascript"> $(function(){ $("#click_wuming_ren").click(function(){ var offset=$("#click_wuming_ren").offset().top; $("#page_wwwwumingren").css("top",offset+"px"); $("#click_wuming_ren").hide(); $("#page_wwwwumingren").animate({ width: "400px", height: "400px", left: ($("body").width()/2-200)+"px", top: (offset-100)+"px", opacity: 'toggle' }, 300 ); //武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) return false; }) $("#close_wuming_ren").click(function(){ var offset=$("#page_wwwwumingren").offset().top; $("#page_wwwwumingren").animate({ width: "0px", height: "0px", left: "0px", top: (offset+100)+"px", opacity: 'toggle' }, 300 ); $("#click_wuming_ren").show(); return false; }) //武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) }) </script> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <div class="askwwwwumingren"> <a class="left_wuming" href="#" id="click_wuming_ren">点击弹出</a> </div> <div class="content"><span style="color:#FF0000">需要加载js文件,请刷新页面后看效果!</span></div> <div class="page_wwwwumingren" id="page_wwwwumingren"> <div> <h1><a href="https://www.wuming.ren" id="close_wuming_ren">x</a>武鸣人</h1> <p><a href="https://www.wuming.ren">武鸣人</a>,各种信息免费发布,资源共享合作共赢!</p> </div> </div> </body> </html>
本文来自武鸣人网站,转载请注明出处