jquery實(shí)現(xiàn)隱藏在左側(cè)的彈性彈出菜單效果
本文實(shí)例講述了jquery實(shí)現(xiàn)隱藏在左側(cè)的彈性彈出菜單效果。分享給大家供大家參考。具體如下:
這是一款隱藏在左側(cè)的彈性彈出菜單,從淘寶扣下來(lái)的,也可作為JavaScript緩沖動(dòng)畫(huà)的典型教程。本彈性菜單可擴(kuò)展性強(qiáng),實(shí)際上不光可以做成菜單,也可布局一些圖文混排的內(nèi)容或一段視頻,總之被彈出的內(nèi)容是在一段Div內(nèi),怎么布置就看你的了。
運(yùn)行效果截圖如下:
在線演示地址如下:
http://demo.jb51.net/js/2015/jquery-left-hidden-alert-adv-codes/
具體代碼如下:
<!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=utf-8" /> <title>隱藏在左側(cè)的彈性彈出菜單</title> <script type="text/javascript" src="jquery1.3.2.js"></script> <script language="javascript"> $(function(){ $("#clickopen").click(function(){ var offset=$("#clickopen").offset().top; $("#page").css("top",offset+"px"); $("#clickopen").hide(); $("#page").animate({ width: "400px", height: "400px", left: ($("body").width()/2-200)+"px", top: (offset-100)+"px", opacity: 'toggle' }, 300 ); return false; }) $("#closepage").click(function(){ var offset=$("#page").offset().top; $("#page").animate({ width: "0px", height: "0px", left: "0px", top: (offset+100)+"px", opacity: 'toggle' }, 300 ); $("#clickopen").show(); return false; }) }) </script> <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;} .ask{overflow:hidden;position:fixed;left:0px;top:200px;z-index:2} .leftButton{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振動(dòng)bug */{background-image:url(about:blank);background-attachment:fixed;} .ask{_position:absolute;_bottom:auto;_left:0;_top: expression(documentElement.scrollTop + 200 + "px");} .page{width:0px; position:absolute;height:0px;left:0;top:0px;z-index:1;overflow:hidden;display:none} .page div{border:1px solid #000;overflow:hidden;width:398px} .page h1{height:40px;text-align:center;font-size:20px;color:#fff;background:red;line-height:40px} .page h1 a{float:right;color:#000;margin-top:-15px} .page p{padding:10px;line-height:22px;font-size:14px;text-align:left;background:#fff;height:400px;width:378px} </style> </head> <body> <div class="ask"> <a class="leftButton" href="#" id="clickopen">點(diǎn)擊彈出</a> </div> <div class="content"></div> <div class="page" id="page"> <div> <h1><a href="#" id="closepage">x</a>您好,歡迎光臨!</h1> <p>腳本之家是國(guó)內(nèi)專(zhuān)業(yè)的網(wǎng)站建設(shè)資源、腳本編程學(xué)習(xí)類(lèi)網(wǎng)站,提供最新的網(wǎng)絡(luò)編程、腳本編程、網(wǎng)頁(yè)制作、網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)頁(yè)特效,為站長(zhǎng)與網(wǎng)絡(luò)編程從業(yè)者提供學(xué)習(xí)資料。 </p> </div> </div> </body> </html>
希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
- jquery實(shí)現(xiàn)鼠標(biāo)滑過(guò)顯示二級(jí)下拉菜單效果
- 基于jquery實(shí)現(xiàn)導(dǎo)航菜單高亮顯示(兩種方法)
- jquery實(shí)現(xiàn)在網(wǎng)頁(yè)指定區(qū)域顯示自定義右鍵菜單效果
- 基于jquery實(shí)現(xiàn)后臺(tái)左側(cè)菜單點(diǎn)擊上下滑動(dòng)顯示
- jquery實(shí)現(xiàn)下拉菜單的二級(jí)聯(lián)動(dòng)利用json對(duì)象從DB取值顯示聯(lián)動(dòng)
- 鼠標(biāo)懸浮顯示二級(jí)菜單效果的jquery實(shí)現(xiàn)
- jquery實(shí)現(xiàn)鼠標(biāo)經(jīng)過(guò)顯示下劃線的漸變下拉菜單效果代碼
- jQuery實(shí)現(xiàn)可高亮顯示的二級(jí)CSS菜單效果
- php+jQuery實(shí)現(xiàn)的三級(jí)導(dǎo)航欄下拉菜單顯示效果
- jQuery實(shí)現(xiàn)點(diǎn)擊后高亮背景固定顯示的菜單效果【附demo源碼下載】
- jQuery實(shí)現(xiàn)菜單的顯示和隱藏功能示例
相關(guān)文章
JQuery Ajax執(zhí)行跨域請(qǐng)求數(shù)據(jù)的解決方案
今天小編就為大家分享一篇關(guān)于JQuery Ajax執(zhí)行跨域請(qǐng)求數(shù)據(jù)的解決方案,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2018-12-12日期時(shí)間范圍選擇插件:daterangepicker使用總結(jié)(必看篇)
下面小編就為大家?guī)?lái)一篇日期時(shí)間范圍選擇插件:daterangepicker使用總結(jié)(必看篇)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-09-09jquery實(shí)現(xiàn)的縮略圖預(yù)覽滑塊實(shí)例
這篇文章主要介紹了jquery實(shí)現(xiàn)的縮略圖預(yù)覽滑塊,實(shí)例分析了jQuery縮略圖預(yù)覽滑塊的實(shí)現(xiàn)與使用技巧,并提供了完整的實(shí)例下載,需要的朋友可以參考下2015-06-06jQuery中removeData()方法用法實(shí)例
這篇文章主要介紹了jQuery中removeData()方法用法,實(shí)例形式分析了removeData()方法移除匹配元素指定數(shù)據(jù)的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2014-12-12jquery計(jì)算鼠標(biāo)和指定元素之間距離的方法
這篇文章主要介紹了jquery計(jì)算鼠標(biāo)和指定元素之間距離的方法,涉及jQuery針對(duì)頁(yè)面位置屬性與鼠標(biāo)事件的相關(guān)操作技巧,需要的朋友可以參考下2015-06-06