jquery+css3實(shí)現(xiàn)的經(jīng)典彈出層效果示例
本文實(shí)例講述了jquery+css3實(shí)現(xiàn)的彈出層效果。分享給大家供大家參考,具體如下:
可能出現(xiàn)的情況
1)一列都有,按順序彈出對(duì)應(yīng)的彈出層
2)只有單個(gè)一個(gè)彈出層
3)不按順序不按規(guī)律隨機(jī)彈出層
jquery 彈出層 解決 第一種情況
參考資料
移動(dòng)端之“CSS3多動(dòng)畫(huà)彈框”
引入jquery
JS代碼 這里關(guān)閉用的css3效果實(shí)現(xiàn)
<script type="text/javascript"> var w,h,className; function getSrceenWH(){ w = $(window).width(); h = $(window).height(); $('#dialogBg').width(w).height(h); } window.onresize = function(){ getSrceenWH(); } $(window).resize(); $(function(){ getSrceenWH(); //顯示彈框 $('.solution_class a').click(function(){ className = $(this).attr('class'); $('#dialogBg').fadeIn(300); $('#dialog').removeAttr('class').addClass('animated '+className+'').fadeIn(); }); //關(guān)閉彈窗 $('.claseDialogBtn,#dialogBg').click(function(){ $('#dialogBg').fadeOut(300,function(){ $('#dialog').addClass('bounceOutUp').fadeOut(); }); }); }); </script>
HTML
<div id="dialogBg"></div> <div id="dialog" class="animated"> <div class="dialogTop"> <a href="javascript:;" rel="external nofollow" class="claseDialogBtn">關(guān)閉</a> </div> </div>
css
/*遮罩層*/ .animated{ -webkit-animation-duration:1.4s; animation-duration:1.4s; -webkit-animation-fill-mode:both; animation-fill-mode:both } @-webkit-keyframes bounceIn{ 0%{ opacity:0; -webkit-transform:scale(.3); transform:scale(.3) } 50%{ opacity:1; -webkit-transform:scale(1.05); transform:scale(1.05) } 70%{ -webkit-transform:scale(.9); transform:scale(.9) } 100%{ opacity:1; -webkit-transform:scale(1); transform:scale(1) } } @keyframes bounceIn{ 0%{ opacity:0; -webkit-transform:scale(.3); -ms-transform:scale(.3); transform:scale(.3) } 50%{ opacity:1; -webkit-transform:scale(1.05); -ms-transform:scale(1.05); transform:scale(1.05) } 70%{ -webkit-transform:scale(.9); -ms-transform:scale(.9); transform:scale(.9) } 100%{ opacity:1; -webkit-transform:scale(1); -ms-transform:scale(1); transform:scale(1) } } .bounceIn{ -webkit-animation-name:bounceIn; animation-name:bounceIn } @-webkit-keyframes bounceInDown { 0% { opacity: 0; -webkit-transform: translateY(-2000px); transform: translateY(-2000px); } 60% { opacity: 1; -webkit-transform: translateY(30px); transform: translateY(30px); } 80% { -webkit-transform: translateY(-10px); transform: translateY(-10px); } 100% { -webkit-transform: translateY(0); transform: translateY(0); } } @keyframes bounceInDown { 0% { opacity: 0; -webkit-transform: translateY(-2000px); -ms-transform: translateY(-2000px); transform: translateY(-2000px); } 60% { opacity: 1; -webkit-transform: translateY(30px); -ms-transform: translateY(30px); transform: translateY(30px); } 80% { -webkit-transform: translateY(-10px); -ms-transform: translateY(-10px); transform: translateY(-10px); } 100% { -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } } .bounceInDown { -webkit-animation-name: bounceInDown; animation-name: bounceInDown; } @-webkit-keyframes bounceOutUp { 0% { -webkit-transform: translateY(0); transform: translateY(0); } 20% { opacity: 1; -webkit-transform: translateY(20px); transform: translateY(20px); } 100% { opacity: 0; -webkit-transform: translateY(-2000px); transform: translateY(-2000px); } } @keyframes bounceOutUp { 0% { -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); } 20% { opacity: 1; -webkit-transform: translateY(20px); -ms-transform: translateY(20px); transform: translateY(20px); } 100% { opacity: 0; -webkit-transform: translateY(-2000px); -ms-transform: translateY(-2000px); transform: translateY(-2000px); } } .bounceOutUp { -webkit-animation-name: bounceOutUp; animation-name: bounceOutUp; } @-webkit-keyframes rollIn { 0% { opacity: 0; -webkit-transform: translateX(-100%) rotate(-120deg); transform: translateX(-100%) rotate(-120deg); } 100% { opacity: 1; -webkit-transform: translateX(0px) rotate(0deg); transform: translateX(0px) rotate(0deg); } } @keyframes rollIn { 0% { opacity: 0; -webkit-transform: translateX(-100%) rotate(-120deg); -ms-transform: translateX(-100%) rotate(-120deg); transform: translateX(-100%) rotate(-120deg); } 100% { opacity: 1; -webkit-transform: translateX(0px) rotate(0deg); -ms-transform: translateX(0px) rotate(0deg); transform: translateX(0px) rotate(0deg); } } .rollIn { -webkit-animation-name: rollIn; animation-name: rollIn; } @-webkit-keyframes flipInX { 0% { -webkit-transform: perspective(400px) rotateX(90deg); transform: perspective(400px) rotateX(90deg); opacity: 0; } 40% { -webkit-transform: perspective(400px) rotateX(-10deg); transform: perspective(400px) rotateX(-10deg); } 70% { -webkit-transform: perspective(400px) rotateX(10deg); transform: perspective(400px) rotateX(10deg); } 100% { -webkit-transform: perspective(400px) rotateX(0deg); transform: perspective(400px) rotateX(0deg); opacity: 1; } } @keyframes flipInX { 0% { -webkit-transform: perspective(400px) rotateX(90deg); -ms-transform: perspective(400px) rotateX(90deg); transform: perspective(400px) rotateX(90deg); opacity: 0; } 40% { -webkit-transform: perspective(400px) rotateX(-10deg); -ms-transform: perspective(400px) rotateX(-10deg); transform: perspective(400px) rotateX(-10deg); } 70% { -webkit-transform: perspective(400px) rotateX(10deg); -ms-transform: perspective(400px) rotateX(10deg); transform: perspective(400px) rotateX(10deg); } 100% { -webkit-transform: perspective(400px) rotateX(0deg); -ms-transform: perspective(400px) rotateX(0deg); transform: perspective(400px) rotateX(0deg); opacity: 1; } } .flipInX { -webkit-backface-visibility: visible !important; -ms-backface-visibility: visible !important; backface-visibility: visible !important; -webkit-animation-name: flipInX; animation-name: flipInX; } /*------------------- 華麗分割線 -----------------------*/ /*------------------- 華麗分割線 -----------------------*/ #dialogBg { width: 100%; height: 100%; background-color: #000000; opacity: .8; filter: alpha(opacity=60); position: fixed; top: 0; left: 0; z-index: 9999; display: none; } #dialog { width: 800px; height: 600px; margin: 0 auto; display: none; background-color: #ffffff; position: fixed; top: 50%; left: 50%; margin: -300px 0 0 -400px; z-index: 10000; border: 1px solid #ccc; border-radius: 10px; -webkit-border-radius: 10px; box-shadow: 3px 2px 4px rgba(0, 0, 0, 0.2); -webkit-box-shadow: 3px 2px 4px rgba(0, 0, 0, 0.2); } .dialogTop { width: 90%; margin: 0 auto; border-bottom: 1px dotted #ccc; letter-spacing: 1px; padding: 10px 0; text-align: right; } .dialogIco { width: 50px; height: 50px; position: absolute; top: -25px; left: 50%; margin-left: -25px; } .editInfos { padding: 15px 0; } .editInfos li { width: 90%; margin: 8px auto auto; text-align: center; } .ipt { border: 1px solid #ccc; padding: 5px; border-radius: 3px; -webkit-border-radius: 3px; box-shadow: 0 0 3px #ccc inset; -webkit-box-shadow: 0 0 3px #ccc inset; margin-left: 5px; } .ipt:focus { outline: none; border-color: #66afe9; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6); -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6); } .submitBtn{width:90px;height:30px;line-height:30px;font-family:"微軟雅黑","microsoft yahei";cursor:pointer;margin-top:10px;display:inline-block;border-radius:5px;-webkit-border-radius:5px;text-align:center;background-color:#428bca;color:#fff;box-shadow: 0 -3px 0 #2a6496 inset;-webkit-box-shadow: 0 -3px 0 #2a6496 inset;}
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
- jQuery+CSS3+Html5實(shí)現(xiàn)彈出層效果實(shí)例代碼(附源碼下載)
- Jquery+CSS3實(shí)現(xiàn)一款簡(jiǎn)潔大氣帶滑動(dòng)效果的彈出層
- jQuery Dialog 彈出層對(duì)話框插件
- jQuery彈出層始終垂直居中相對(duì)于屏幕或當(dāng)前窗口
- jquery實(shí)現(xiàn)居中彈出層代碼
- JQuery彈出層示例可自定義
- jQuery+html5實(shí)現(xiàn)div彈出層并遮罩背景
- jQuery插件zoom實(shí)現(xiàn)圖片全屏放大彈出層特效
- JQUERY THICKBOX彈出層插件
- jQuery Mobile彈出窗、彈出層知識(shí)匯總
- jQuery點(diǎn)縮略圖彈出層顯示大圖片
- jQuery Layer彈出層傳值到父頁(yè)面的實(shí)現(xiàn)代碼
相關(guān)文章
jQuery實(shí)現(xiàn)鼠標(biāo)移到某個(gè)對(duì)象時(shí)彈出顯示層功能
這篇文章主要介紹了jQuery實(shí)現(xiàn)鼠標(biāo)移到某個(gè)對(duì)象時(shí)彈出顯示層功能,涉及jQuery基于事件響應(yīng)動(dòng)態(tài)操作頁(yè)面元素屬性相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2018-08-08一個(gè)CSS+jQuery實(shí)現(xiàn)的放大縮小動(dòng)畫(huà)效果
放大縮小動(dòng)畫(huà)效果實(shí)現(xiàn)的方法有很多,下面有個(gè)不錯(cuò)的示例,使用CSS+jQuery實(shí)現(xiàn)的,感興趣的朋友可以了解下2014-02-02jQuery+Datatables實(shí)現(xiàn)表格批量刪除功能【推薦】
這篇文章主要介紹了jQuery+Datatables實(shí)現(xiàn)表格批量刪除功能,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2018-10-10jQuery.extend()、jQuery.fn.extend()擴(kuò)展方法示例詳解
這篇文章主要介紹了jQuery.extend()、jQuery.fn.extend()擴(kuò)展方法的應(yīng)用,需要的朋友可以參考下2014-05-05使用jQuery ajaxupload插件實(shí)現(xiàn)無(wú)刷新上傳文件
項(xiàng)目中會(huì)經(jīng)常用到AJAX無(wú)刷新上傳圖片,但是iframe上傳和flash插件都是比較復(fù)雜的,所以就找了一個(gè)jquery的插件。下面通過(guò)實(shí)例代碼給大家介紹使用jQuery ajaxupload插件實(shí)現(xiàn)無(wú)刷新上傳文件功能,需要的朋友參考下吧2017-04-04