欧美大片黄色-哪有黄色网址-岛国av在线播放-91啦丨porny丨刺激-99er视频-a毛片在线免费观看-日日操狠狠操-日韩av在线影视-国产精品一区二区久久久久-亚洲精品播放-亚洲免费视频专区-国产第二页-亚洲精品99-变态另类丨国产精品-特黄一级大片-亚洲制服一区-天堂√在线中文最新版

利晶設(shè)計(jì)機(jī)構(gòu)博客

關(guān)注研究網(wǎng)站設(shè)計(jì)及SEO網(wǎng)站優(yōu)化技術(shù)!致力于為客戶提供最專業(yè)、最有效的全方面網(wǎng)站設(shè)計(jì)解決方案。

訂閱RSS

右下角彈窗廣告效果JS代碼

類別:網(wǎng)站前端開發(fā)    時(shí)間:2010-12-24

右下角彈窗廣告效果JS代碼,有應(yīng)用于定時(shí)提示用戶,或投放小廣告。

<script type="text/javascript">
var RBMessage={
 boxW:200,
 boxH:101,
 init:function(){
  var that = this;
  this.createBox();
  document.getElementById("msg_close").onclick = function() {
            that.BoxWin.style.display="none";
        }
 },
 bind: function() { //綁定窗口滾動(dòng)條與大小變化事件
        var that = this,
        st, rt;
        window.onscroll = function() {
   if( !!window.ActiveXObject && !window.XMLHttpRequest ){
    clearTimeout(st);
    clearTimeout(that.timer2);
    that.setOpacity(0);
    st = setTimeout(function() {
     that.BoxWin.style.top = that.getY().top;
     that.show();
    },500);
   }
        };
        window.onresize = function(){
   if (!!window.ActiveXObject && !window.XMLHttpRequest) {
    clearTimeout(rt);
    rt = setTimeout(function(){
     that.BoxWin.style.top = that.getY().top
    }, 100);
   }
  }
    },
 show: function() { //漸顯
        clearInterval(this.timer2);
        var that = this,
        fx = this.fx(0, 100, 0.1),
        t = 0;
        this.timer2 = setInterval(function() {
            t = fx();
            that.setOpacity(t[0]);
            if (t[1] == 0) {
                clearInterval(that.timer2)
            }
        },
        10);
    },
 fx: function(a, b, c) { //緩沖計(jì)算
        var cMath = Math[(a - b) > 0 ? "floor": "ceil"],
        c = c || 0.1;
        return function() {
            return [a += cMath((b - a) * c), a - b]
        }
    },
 setOpacity: function(x) { //設(shè)置透明度
        var v = x >= 100 ? '': 'Alpha(opacity=' + x + ')';
        this.BoxWin.style.visibility = x <= 0 ? 'hidden': 'visible'; //IE有絕對(duì)或相對(duì)定位內(nèi)容不隨父透明度變化的bug
        this.BoxWin.style.filter = v;
        this.BoxWin.style.opacity = x / 100;
    },
 getY: function() { //計(jì)算移動(dòng)坐標(biāo)
        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.BoxWin.offsetHeight;
        return {
            foot: s + h + h2 + 2 + 'px',
            top: s + h - h2 - 2 + 'px'
        }
    },
 moveTo: function(y) { //移動(dòng)動(dòng)畫
        clearInterval(this.timer);
        var that = this;
  var moveTopNum=-that.boxH;
        this.timer = setInterval(function() {
   moveTopNum+=5;
            that.BoxWin.style.bottom =  moveTopNum +'px';
            if (moveTopNum >= 0) {
                clearInterval(that.timer);
    that.bind();
            }
        },50);
  return this;
    },
 createBox:function(){
  this.BoxWin=document.createElement('div');
        this.BoxWin.style.width = this.boxW+"px";
        this.BoxWin.style.height =  this.boxH+"px";
  this.BoxWin.style.bottom = - this.boxH+"px";
        this.BoxWin.id = "msg_win";
        this.BoxWin.innerHTML = '<div class="icos"><a href="javascript:void 0" title="關(guān)閉" id="msg_close">X</a></div><div id="msg_title">溫馨提示(標(biāo)題)</div><div id="msg_content"></div>';
        document.body.appendChild(this.BoxWin);
  var that = this;
  setTimeout(function() { //初始化最先位置
            that.BoxWin.style.display = 'block';
            that.moveTo();
        },1000);
  return this;
 }
};
RBMessage.init();
</script>

轉(zhuǎn)載聲明:
原載:利晶科技博客 - 關(guān)注研究最新網(wǎng)站設(shè)計(jì)技術(shù)及SEO網(wǎng)站優(yōu)化!
本文鏈接:http://www.713vvvx.cn/blog/ad-right-js.html
如需轉(zhuǎn)載必須以鏈接形式注明原載或原文地址,謝謝合作!

文章分類

服務(wù)項(xiàng)目

友情鏈接

Copyright © 2006-2012 利晶設(shè)計(jì)機(jī)構(gòu) 版權(quán)所有
永定县| 象山县| 安达市| 延安市| 武平县| 绿春县| 固阳县| 西林县| 万全县| 登封市| 榆树市| 县级市| 舞阳县| 斗六市| 定安县| 华亭县| 河北省| 界首市| 驻马店市| 靖安县| 鹤峰县| 遂宁市| 措美县| 同德县| 太谷县| 逊克县| 萍乡市| 南陵县| 莱芜市| 霞浦县| 晋江市| 平湖市| 余干县| 佳木斯市| 长宁区| 江阴市| 乌拉特后旗| 瑞昌市| 湖州市| 雷州市| 荣成市|