当前位置:编程学习 > JS >>

兼容火狐的jQuery图标抖动效果

兼容火狐的jQuery图标抖动效果,测试时候发现好像在IE8中有些问题,其它的浏览器都可以,图标一抖一抖的,很可爱。
答案:<!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>Rotate</title>
<script src="http://www.zzzyk.com/ajaxjs/jquery-1.6.4.min.js"></script>
<script>
$(function(){
		 function state1(){
			 $(".rotate").removeClass("r2"); 
			 $(".rotate").addClass("r1");
			 setTimeout(state2,90);
		 }
		function state2(){	   
		     $(".rotate").removeClass("r1");
		     $(".rotate").addClass("r2"); 
			 setTimeout(state1,90);
		}
		state1();
		
})


</script>

<style>
body{
	background:url(wood-oak.jpg);
}

.tips{
	width:650px;
	margin:110px auto 0;
	font-family:Verdana, Geneva, sans-serif;
	color:#FFC;
	font-size:26px;
}

.dock{
	margin:90px auto 0;
	width:500px; 
}

.board{
	float:left;
	margin-top:-60px;
	z-index:0;
}

.rotate{
	width:70px;
	height:70px;
	margin:20px 10px;
	z-index:1;
}

.r1{
	 -moz-transform:rotate(-3deg);
    -webkit-transform:rotate(-3deg);
	-o-transform:rotate(-3deg);
}

.r2{
	 -moz-transform:rotate(2deg);
    -webkit-transform:rotate(2deg);
	-o-transform:rotate(2deg);
}
</style>
</head>

<body>
<p class="tips">Tip: You may need to use the browser like chrome锛?firefox or safari  which supports CSS attribute to watch this rotate effect...</p>
<div class="dock">
      <img src="http://www.zzzyk.com/jscss/demoimg/201111/FireFox.png" class="rotate" alt="icon"/>
      <img src="http://www.zzzyk.com/jscss/demoimg/201111/IE.png" class="rotate" alt="icon"/>
</div>
<img  class="board" src="http://www.zzzyk.com/jscss/demoimg/201111/woodboard1.png" />
</body>
</html>

上一个:Js图片切换,百度有啊图片展示代码
下一个:JS百叶窗图片特效代码

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,