jQuery的出现,使得普通JS脚本逊色了很多,jQuery随时会带给我们炫丽而无法想像的效果,今天最火软件站(原网)再带给大家一个炫彩的jQuery网页特效,在本例当中,使用了两张普通的花朵图片,但是通过jQuery让它们变得动感起来,小编给他取名为:百叶展开效果。不管形容的对不对吧,大家一起来学习!
为解决一些网页特效运行后不能显示效果(例如:jQuery则需要刷新)问题,特别新增网页版演示。
点击查看:网页特效
运行演示:
<!DOCTYPE html><html><head><title>jquery 花朵绽放动画 _ 最火软件站(原网)</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" src="/uploads/common/js/jquery-1.7.min.js"></script><style type="text/css">*{margin: 0px;padding: 0px;}#test{width:300px; height: 300px; position: relative; margin: 20px auto 0px;}</style></head><body><div id="test"><img alt="" width="300" height="300" src="/uploads/allimg/1207/wfuyu_r_test1.jpg" /></div><script type="text/javascript">$(function(){var test = $("#test");var html = '';for(var i=0;i<5;i++){html+='<div style="width:60px;height:300px;position:absolute;top:0px;left:'+60*i+'px;background:url(/uploads/allimg/1207/wfuyu_r_test1.jpg) '+-60*i+'px 0px no-repeat;"></div>';}test.prepend(html);test.find("div").eq(0).animate({ "top":"320px"},2000);test.find("div").eq(1).animate({ "top":"320px"},2500);test.find("div").eq(2).animate({ "top":"320px"},3000);test.find("div").eq(3).animate({ "top":"320px"},3500);test.find("div").eq(4).animate({ "top":"320px"},4000);test.find("div").eq(0).delay(5000);test.find("div").eq(4).delay(3000);test.find("div").eq(1).delay(5000);test.find("div").eq(3).delay(4000);test.find("div").eq(2).delay(5000);test.find("div").eq(0).animate({ "left":"-320px","top":"0px","width":"300px","height":"300px"},5000);test.find("div").eq(4).animate({ "left":"320px","top":"0px","width":"300px","height":"300px","background-position":"0px 0px"},5000);test.find("div").eq(1).animate({ "left":"-320px","top":"320px","width":"300px","height":"300px","background-position":"0px 0px"},4500);test.find("div").eq(3).animate({ "left":"320px","top":"320px","width":"300px","height":"300px","background-position":"0px 0px"},4500);test.find("div").eq(2).animate({ "left":"0px","top":"320px","width":"300px","height":"300px","background-position":"0px 0px"},4000);test.find("div").eq(0).delay(2000);test.find("div").eq(4).delay(2000);test.find("div").eq(1).delay(2000);test.find("div").eq(3).delay(2000);test.find("div").eq(2).delay(2000);test.find("div").eq(0).animate({ "left":"0px","top":"0px","width":"300px","height":"300px","background-position":"0px 0px"},5000);test.find("div").eq(4).animate({ "left":"0px","top":"0px","width":"300px","height":"300px","background-position":"0px 0px"},5000);test.find("div").eq(1).animate({ "left":"0px","top":"0px","width":"300px","height":"300px","background-position":"0px 0px"},4500);test.find("div").eq(3).animate({ "left":"0px","top":"0px","width":"300px","height":"300px","background-position":"0px 0px"},4500);test.find("div").eq(2).animate({ "left":"0px","top":"0px","width":"300px","height":"300px","background-position":"0px 0px"},4000);test.find("div").eq(0).delay(2000);test.find("div").eq(4).delay(2000);test.find("div").eq(1).delay(2000);test.find("div").eq(3).delay(2000);test.find("div").eq(2).delay(2000);test.find("div").eq(0).animate({ "left":"0px","top":"300px","width":"60px","height":"300px","background-position":"0px 0px"},5000,function(){test.find("img").css({"position":"absolute","left":"0px","top":"0px","z-index":"999"}); test.find("div").css({"background":"url(/uploads/allimg/1207/wfuyu_r_test3.jpg) no-repeat"});});test.find("div").eq(4).animate({ "left":"240px","top":"300px","width":"60px","height":"300px","background-position":"-240px 0px"},5000);test.find("div").eq(1).animate({ "left":"60px","top":"200px","width":"60px","height":"300px","background-position":"-60px 0px"},4500);test.find("div").eq(3).animate({ "left":"180px","top":"200px","width":"60px","height":"300px","background-position":"-180px 0px"},4500);test.find("div").eq(2).animate({ "left":"120px","top":"300px","width":"60px","height":"300px","background-position":"-120px 0px"},4000);});</script></body></html><div style="text-align:center;margin:30px 0 0 0;"><hr style="color:#999;height:1px;">如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.wfuyu.com/' target='_blank'>http://www.wfuyu.com/</a></div>提示:可修改后代码再运行!
上一篇 合并css和js文件 加快网站浏览速度
下一篇 如何选择免费虚拟主机及其五点注意事项