【www.gdgbn.com--手机软件】
float message
<script>
var message={
set: function() {//最小化与恢复状态切换
var set=this.minbtn.status == 1?[0,1,"block",this.char[0],"最小化"]:[1,0,"none",this.char[1],"恢复"];
this.minbtn.status=set[0];
this.win.style.borderbottomwidth=set[1];
this.content.style.display =set[2];
this.minbtn.innerhtml =set[3]
this.minbtn.title = set[4];
this.win.style.top = this.gety().top;
},
close: function() {//关闭
this.win.style.display = "none";
window.onscroll = null;
},
setopacity: function(x) {//设置透明度
var v = x >= 100 ? "": "alpha(opacity=" + x + ")";
this.win.style.visibility = x<=0?"hidden":"visible";//ie有绝对或相对定位内容不随父透明度变化的bug
this.win.style.filter = v;
this.win.style.opacity = x / 100;
},
show: function() {//渐显
clearinterval(this.timer2);
var me = this,fx = this.fx(0, 100, 0.1),t = 0;
this.timer2 = setinterval(function() {
t = fx();
me.setopacity(t[0]);
if (t[1] == 0) {clearinterval(me.timer2) }
},10);
},
fx: function(a, b, c) {//缓冲计算
var cmath = math[(a - b) > 0 ? "floor": "ceil"],c = c || 0.1;
return function() {return [a += cmath((b - a) * c), a - b]}
},
gety: function() {//计算移动坐标
var d = document,b = document.body, e = document.documentelement;
var s = math.max(b.scrolltop, e.scrolltop);
var h = /backcompat/i.test(document.compatmode)?b.clientheight:e.clientheight;
var h2 = this.win.offsetheight;
return {foot: s + h + h2 + 2+"px",top: s + h - h2 - 2+"px"}
},
moveto: function(y) {//移动动画
clearinterval(this.timer);
var me = this,a = parseint(this.win.style.top)||0;
var fx = this.fx(a, parseint(y));
var t = 0 ;
this.timer = setinterval(function() {
t = fx();
me.win.style.top = t[0]+"px";
if (t[1] == 0) {
clearinterval(me.timer);
me.bind();
}
},10);
},
bind:function (){//绑定窗口滚动条与大小变化事件
var me=this,st,rt;
window.onscroll = function() {
cleartimeout(st);
cleartimeout(me.timer2);
me.setopacity(0);
st = settimeout(function() {
me.win.style.top = me.gety().top;
me.show();
},600);
};
window.onresize = function (){
cleartimeout(rt);
rt = settimeout(function() {me.win.style.top = me.gety().top},100);
}
},
init: function() {//创建html
function $(id) {return document.getelementbyid(id)};
this.win=document.createelement("div");
this.win.id="msg_win";
this.win.innerhtml="网页特效:void 0" title="最小化" id="msg_min">0r温馨提示";
document.body.appendchild(this.win);
var set={minbtn: "msg_min",closebtn: "msg_close",title: "msg_title",content: "msg_content"};
for (var id in set) {this[id] = $(set[id])};
var me = this;
this.minbtn.onclick = function() {me.set();this.blur()};
this.closebtn.onclick = function() {me.close()};
this.char=navigator.useragent.tolowercase().indexof("firefox")+1?["_","::","×"]:["0","2","r"];//ff不支持webdings字体
this.minbtn.innerhtml=this.char[0];
this.closebtn.innerhtml=this.char[2];
settimeout(function() {//初始化最先位置
me.win.style.display = "block";
me.win.style.top = me.gety().foot;
me.moveto(me.gety().top);
},500);
return this;
}
};
message.init();
message.title.innerhtml = "时尚-型男索女潮流馆";
message.content.innerhtml = "";
</script>
右下角浮动广告代码二
网页特效观止|111cn.net|---页面右下角弹出类似qq或msn的消息提示
<script language=javascript>
</script>