弹出框

<!--弹出框-->
<div style="top: 220px; left: 10px; position: absolute;" class="QQ" id="qq_Kefu">

<a href="http://float2006.tq.cn/static.jsp?version=vip&amp;admiuin=9449699&amp;ltype=0&amp;iscallback=1&amp;is_message_sms=0&amp;is_send_mail=1&amp;uin=9449702" target="_blank">

<img src="images/kefu.jpg" height="256" width="119" />
</a>
<input type="button" value="X" style="20px; height:20px; float:right" onClick="CoLse()"/>
 <script type="text/javascript">
function CoLse(){
 var qq=document.getElementById('qq_Kefu');
 qq.style.display='none';
 
}
 </script>
 </div>

js

lastScrollY = 0;
var InterTime = 1;
var maxWidth = -1;
var minWidth = 1;
var numInter = 8;
var BigInter;
var SmallInter;
Kefu = function (id, _top, _right)
{
    var me = id.charAt ? document.getElementById(id) : id,
    d1 = document.body,
    d2 = document.documentElement;
    d1.style.height = d2.style.height = '100%';
    me.style.top = _top ? _top + 'px' : 0;
    me.style.right = _right + "px";
    me.style.position = 'absolute';
    setInterval(function ()
    {
        me.style.top = parseInt(me.style.top) + (Math.max(d1.scrollTop, d2.scrollTop) + _top - parseInt(me.style.top)) * 0.1 + 'px'
    }, 10 + parseInt(Math.random() * 20));
    return arguments.callee
};
window.onload = function ()
{
    Kefu('qq_Kefu', 30, 10);
    o = document.getElementById("qq_Kefu");
    i = parseInt(o.style.right);
};
function Big()
{
    if (parseInt(o.style.right) < maxWidth)
    {
        i = parseInt(o.style.right);
        i += numInter;
        o.style.right = i + "px";
        if (i == maxWidth)
            clearInterval(BigInter)
    }
};
function toBig()
{
    clearInterval(SmallInter);
    clearInterval(BigInter);
    BigInter = setInterval(Big, InterTime)
};
function Small()
{
    if (parseInt(o.style.right) > minWidth)
    {
        i = parseInt(o.style.right);
        i -= numInter;
        o.style.right = i + "px";
        if (i == minWidth)
            clearInterval(SmallInter)
    }
};
function toSmall()
{
    clearInterval(SmallInter);
    clearInterval(BigInter);
    SmallInter = setInterval(Small, InterTime)
}

原文地址:https://www.cnblogs.com/xiaoleidiv/p/3211721.html