jquery淡入淡出无延迟代码
2013-12-28 17:22
417 查看
<!DOCTYPE html> <html> <head> <script src="jquery.js"></script> <script> $(document).ready(function(){ $("#button1").mouseover(function(){ $(".div1").stop().animate({opacity:1},1000); $(".div2").stop().animate({opacity:1},1000); $(".div3").stop().animate({opacity:1},1000); }); $("#button1").mouseleave(function(){ $(".div1").stop().animate({opacity:0},1000); $(".div2").stop().animate({opacity:0},1000); $(".div3").stop().animate({opacity:0},1000); }); }); </script> </head> <body> <button id="button1">鼠标放在这里,使三个矩形淡入</button> <div class="div1" style="width:80px;height:80px;opacity:0;background-color:red;"></div> <br> <div class="div2" style="width:80px;height:80px;opacity:0;background-color:green;"></div> <br> <div class="div3" style="width:80px;height:80px;opacity:0;background-color:blue;"></div> </body> </html>
另外
function () { $(".div1").animate({ 'opacity': 0 },{ queue: false, duration: 1000 }); },
function () { $(".div1").animate({ 'opacity': 1 }, { queue: false, duration: 1000 }); }
也可以。
相关文章推荐
- jquery 的小区别 总结中。。。
- jQuery新建HTML Element
- 解决一个页面多个Jquery冲突问题
- JQuery+ajax实现批量上传图片
- 第二章 jQuery技术解密 (七)
- 第二章 jQuery技术解密 (六)
- 学习JQuery - 2
- 第二章 jQuery技术解密 (五)
- 第二章 jQuery技术解密 (四)
- 第二章 jQuery技术解密 (三)
- 第二章 jQuery技术解密 (二)
- 第二章 jQuery技术解密(一)
- 第1章 jQuery 起步
- jquery easyui DateBox 日期框 获取不到text值的问题
- 使用jQuery Mobile + PhoneGap 开发Android应用程序(转)
- [ jQuery] 你还在使用jquery的click(),bind()方法么?
- 你还在使用jquery的click(),bind()方法么?
- jquery表单验证
- 系统学习jQuery.核心知识.局部.jQuery操作.DOM操作.替换节点
- 系统学习jQuery.核心知识.局部.jQuery操作.DOM操作.复制节点