js 窗口抖動示例
更新時間:2013年09月04日 17:33:34 作者:
想必大家對窗口抖動一詞并不陌生吧,其實原理很簡單,下面為大家簡單介紹下js中時如何實現(xiàn)的,喜歡的朋友可以參考下
復制代碼 代碼如下:
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script >
function zd(u){
var a=['top','left'],b=0;
u=setInterval(function(){
document.getElementById('win').style[a[b%2]]=(b++)%4<2?0:4;
if(b>15){clearInterval(u);b=0}
},32)
}
</script>
</head>
<body id="win" style='position:relative;' border="1">
<button onclick="zd()">振動</button>
<div >asdfasdf<div/>
</body>
</html>
相關(guān)文章
詳解JavaScript原生封裝ajax請求和Jquery中的ajax請求
在本篇文章中我們總結(jié)了關(guān)于JavaScript原生封裝ajax請求和Jquery中的ajax請求的知識點內(nèi)容,需要的朋友們學習參考下。2019-02-02調(diào)試Node.JS的輔助工具(NodeWatcher)
Node.JS調(diào)試貌似比較麻煩,每次改完了要重啟一下Node進程.GOOGLE上有個NPM模塊,可以監(jiān)控JS文件的更改,然后自動重啟Node.但我下載后在windows里運行報錯2012-01-01