JavaScript實(shí)現(xiàn)簡(jiǎn)單的彈窗效果
更新時(shí)間:2020年05月19日 08:30:50 作者:安心寫bug
這篇文章主要為大家詳細(xì)介紹了JavaScript實(shí)現(xiàn)簡(jiǎn)單的彈窗效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家分享了JavaScript實(shí)現(xiàn)彈窗效果的具體代碼,供大家參考,具體內(nèi)容如下
使用css動(dòng)畫效果實(shí)現(xiàn)彈窗緩慢彈出和收回。
使用JavaScript實(shí)現(xiàn)定時(shí)彈出定時(shí)收回。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>簡(jiǎn)單彈窗</title> <style> * { margin: 0; padding: 0; } .pop { width: 400px; height: 300px; position: fixed; bottom: 0; right: 0; display: none; animation: pop 1s ease-in-out 0s; } @keyframes pop { from { height: 0; } to { height: 300px; } } .down { width: 400px; height: 0; position: fixed; bottom: 0; right: 0; display: block; animation: out 1s ease-in-out; } @keyframes out { from { height: 300px; } to { height: 0; } } .img1 { width: 400px; height: 300px; vertical-align: top; } </style> </head> <body> <div class="pop" id="pop"> <img src="images/01.jpg" alt="" class="img1"> </div> </body> <script> window.onload = function () { timer = window.setInterval(imgBlock, 2000); }; function imgBlock() { var pop = document.getElementById('pop'); pop.style.display = 'block'; timer2 = window.setInterval(imgNone,5000); } function imgNone() { var pop = document.getElementById('pop'); pop.className = 'down'; clearInterval(timer); clearInterval(timer2); } </script> </html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- js彈出框、對(duì)話框、提示框、彈窗實(shí)現(xiàn)方法總結(jié)(推薦)
- js彈窗返回值詳解(window.open方式)
- js彈窗代碼 可以指定彈出間隔
- js退出彈窗代碼集合
- js點(diǎn)擊彈出div層實(shí)現(xiàn)可拖曳的彈窗效果
- JS彈窗 JS彈出DIV并使整個(gè)頁(yè)面背景變暗功能的實(shí)現(xiàn)代碼
- js調(diào)用父框架函數(shù)與彈窗調(diào)用父頁(yè)面函數(shù)的簡(jiǎn)單方法
- JS實(shí)現(xiàn)自定義彈窗功能
- 關(guān)于vue.js彈窗組件的知識(shí)點(diǎn)總結(jié)
- js實(shí)現(xiàn)彈窗插件功能實(shí)例代碼分享
相關(guān)文章
javascript將數(shù)字轉(zhuǎn)換整數(shù)金額大寫的方法
這篇文章主要介紹了javascript將數(shù)字轉(zhuǎn)換整數(shù)金額大寫的方法,通過(guò)自定義函數(shù)中的數(shù)組替換實(shí)現(xiàn)數(shù)字轉(zhuǎn)換整數(shù)金額大寫的功能,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-01-01javascript筆記 String類replace函數(shù)的一些事
加固javascript基礎(chǔ)知識(shí)目的是為以后研究jQuery源碼做好鋪墊。2011-09-09利用JS獲取IE客戶端IP及MAC的實(shí)現(xiàn)好象不可以
利用JS獲取IE客戶端IP及MAC的實(shí)現(xiàn)好象不可以...2007-01-01