<!DOCTYPE html> <html> <head> <title>test</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("div").click(function(){ if($(this).hasClass("red")){ $(this) .animate({left:120}) .animate({left:240}) .animate({left:0}) .animate({left:240}) .animate({left:120}); } }) }); </script> <style type="text/css"> div{ position: absolute; width: 100px; height: 100px; } .blue{ left: 0px; background: blue; } .red{ left: 120px; background: red; z-index: 1; } .green{ left: 240px; background: green; } .pos{ top: 120px; } </style> </head> <body> <div class="blue"></div> <div class="red"></div> <div class="green"></div> <div class="red pos"></div> </body> </html>
运行结果:
成都创新互联公司专注于运城网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供运城营销型网站建设,运城网站制作、运城网页设计、运城网站官网定制、成都微信小程序服务,打造运城网络公司原创品牌,更为您提供运城网站排名全网营销落地服务。另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享题目:jQuery学习示例------点击红色方块实现左右晃动-创新互联
本文链接:https://www.cdcxhl.com/article24/dscsje.html
成都网站建设公司_创新互联,为您提供定制网站、网站策划、网站设计、网站改版、营销型网站建设、手机网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联