ITeye博客

滑动门通用JS

mac.zhao · 2011-02-25 17:03 · Web前端 · Markdown

createAdv:function(){ //调用内部浮动 入口!! var _this = this; _this.createFloatDiv(); setInterval(function(){_this.createAdvPro();},10);

}, floatPro:function(){//非类内部创建层的 浮动效果 var bodyScrollTop = document.documentElement.scrollTop;
if(this.fDiv.style.top != bodyScrollTop + this.h) { this.$(this.fDiv).style.top = parseInt(this.$(this.fDiv).style.top) + Math.ceil((bodyScrollTop + this.h - parseInt(this.$(this.fDiv).style.top))/20) + "px";

} }, $:function(o){ //获取对象 if(typeof(o) == "string") return document.getElementById(o); return o; }, begins:function(o,h){//调用浮动 入口!! var _this = this; _this.fDiv = _this.$(o); _this.h = h; //alert(this.fDiv.id); setInterval(function(){_this.floatPro();},10); } } window.onload = function(){ var m = new floatAdver(); //m.begins("b",200); var m2 = new floatAdver(); //m2.begins("a",200); m2.createInfo("background:#FFF;height:200px;width:100px;border:1px solid #CCC;","background:#DDD;height:200px;width:100px;border:1px solid #CCC;","浮动预览,左边浮动层内容","浮动预览,右边浮动层的内容",200); m2.createAdv(); }

createAdv:function(){ //调用内部浮动 入口!! var _this = this; _this.createFloatDiv(); setInterval(function(){_this.createAdvPro();},10);

}, floatPro:function(){//非类内部创建层的 浮动效果 var bodyScrollTop = document.documentElement.scrollTop;
if(this.fDiv.style.top != bodyScrollTop + this.h) { this.$(this.fDiv).style.top = parseInt(this.$(this.fDiv).style.top) + Math.ceil((bodyScrollTop + this.h - parseInt(this.$(this.fDiv).style.top))/20) + "px";

} }, $:function(o){ //获取对象 if(typeof(o) == "string") return document.getElementById(o); return o; }, begins:function(o,h){//调用浮动 入口!! var _this = this; _this.fDiv = _this.$(o); _this.h = h; //alert(this.fDiv.id); setInterval(function(){_this.floatPro();},10); } }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。