jquery实现烟花效果(面向对象)
本文实例为大家分享了jquery实现烟花效果的具体代码,供大家参考,具体内容如下
烟花效果(面向对象) *{padding:0;margin:0} body{overflow:hidden;width:100%;height:100%;background:#000;} div{position:absolute;background:#000;color:#fff} varfirWorks={ init:function(){//初始化 var_that=this; $(document).bind("click",function(e){ _that.eventLeft=e.pageX; _that.eventTop=e.pageY; _that.createCylinder(); }); }, createCylinder:function(event){//创建一个花筒 var_that=this; this.cHeight=document.documentElement.clientHeight;//浏览器高度 this.cylinder=$(""); $("body").append(this.cylinder); this.cylinder.css({"width":4,"height":15,"background-color":"red","top":this.cHeight,"left":this.eventLeft}); this.cylinder.animate({top:this.eventTop},600,function(){ $(this).remove(); _that.createFlower(); }) }, createFlower:function(){//创建很多很多的烟花哇!! /*烟花效果 *1.烟花是很多个DIV构成 *2.每个烟花的颜色不一样 *3.烟花的位置也不一样 *4.烟花散开方向不一样 *5.烟花有下坠感觉 */ //通过循环可以创建你想要的烟花啦!!! var_that=this; for(vari=0;i<30;i++){ $("body").append($("
更多JavaScript精彩特效分享给大家:
jQuery幻灯片特效汇总
jQuery焦点图特效汇总
jQuery级联菜单特效汇总
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。