Cool JavaScript Tricks

参考:http://www.blogohblog.com/cool-javascript-tricks/

网页图片rotate效果:

<script type="text/javascript">
	document.body.contentEditable=‘true‘; 
	document.designMode=‘on‘; 
	
	var radius = 0;
	var imgs = document.getElementsByTagName("img");
	var img_count = imgs.length;
	setInterval(function() {
		for(var i = 0; i < img_count; i++) {
			imgs[i].style.position = "absolute";
			imgs[i].style.left = (Math.sin(radius*0.05) + 1)*300 + "px";
			imgs[i].style.top = (Math.cos(radius*0.05) + 1)*300 + "px";
		}
		radius++;
	}, 5);
</script>



Cool JavaScript Tricks,布布扣,bubuko.com

Cool JavaScript Tricks

上一篇:C#中几种执行SQL的方法


下一篇:javascript动态添加div