網(wǎng)頁(yè)右側(cè)懸浮滾動(dòng)在線qq客服代碼示例
更新時(shí)間:2014年04月28日 09:42:41 作者:
這篇文章主要介紹了網(wǎng)頁(yè)右側(cè)懸浮滾動(dòng)qq在線客服代碼示例,需要的朋友可以參考下
網(wǎng)頁(yè)右側(cè)懸浮滾動(dòng)QQ在線客服代碼
復(fù)制代碼 代碼如下:
function myEvent(obj,ev,fn){
if (obj.attachEvent){
obj.attachEvent('on'+ev,fn);
}else{
obj.addEventListener(ev,fn,false);
};
};
function getbyClass(id,sClass){
var oParent = document.getElementById(id);
var all = oParent.getElementsByTagName('*');
var array = [];
for (var i=0; i<all.length; i++){
if (all[i].className == sClass){
array.push(all[i]);
};
};
return array;
};
function getStyle(obj,name){
if(obj.currentStyle){
return obj.currentStyle[name];
}else{
return getComputedStyle(obj,false)[name];
};
};
function Running(obj,json,fnEnd){
clearInterval(obj.timer);
obj.timer=setInterval(function(){
var now=0;
var bStop=true;
for (var attr in json){
if(attr=='opacity'){
now=Math.round(parseFloat(getStyle(obj,attr))*100);
}else{
now=parseInt(getStyle(obj,attr));
};
var speed=(json[attr]-now)/5;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(now!=json[attr])bStop=false;
if(attr=='opacity'){
obj.style.filter='alpha(opacity:'+now+speed+')';
obj.style.opacity=(now+speed)/100;
}else{
obj.style[attr]=speed+now+'px';
};
}
if(bStop){
clearInterval(obj.timer);
if(fnEnd)fnEnd();
}
}, 30);
}
function Flexing(obj,json,fnEnd){
clearInterval(obj.timer);
obj.timer=setInterval(function(){
var now=0;
var bStop=true;
for (var attr in json){
if(!obj.speed)obj.speed={};
if(!obj.speed[attr])obj.speed[attr]=0;
now=parseInt(getStyle(obj,attr));
if(Math.abs(json[attr]-now)>1 || Math.abs(obj.speed[attr])>1){
bStop=false;
obj.speed[attr]+=(json[attr]-now)/5;
obj.speed[attr]*=0.85;
var MaxSpeed=65;
if(Math.abs(obj.speed[attr])>MaxSpeed){
obj.speed[attr]=obj.speed[attr]>0?MaxSpeed:-MaxSpeed;
};
obj.style[attr]=now+obj.speed[attr]+'px';
};
};
if(bStop){
clearInterval(obj.timer);
obj.style[attr]=json[attr]+'px';
if(fnEnd)fnEnd();
};
}, 30);
}
function setqq(obj,num){
if (obj.length!=num.length){
alert('\nspan的個(gè)數(shù)與QQ號(hào)碼的個(gè)數(shù)不符,請(qǐng)?jiān)O(shè)置5個(gè)QQ號(hào)碼!\n\n[設(shè)置未成功!]');
return;
}else{
for (var i=0; i<num.length; i++){
obj[i].innerHTML = "<a target='_blank' ><img border='0' src='http://wpa.qq.com/pa?p=2:"+num[i]+":51' alt='點(diǎn)擊咨詢' title='點(diǎn)擊咨詢'/></a>";
};
};
};
function settop(id,id2,top){
var obj = document.getElementById(id);
var box = document.getElementById(id2);
obj.style.top = box.style.top = top+'px';
};
function dealy(id,time){
var obj = document.getElementById(id);
var timer = setTimeout(function(){
Flexing(obj,{right:-100});
},time*1000);
};
function click_fn(id,id2){
var obj = document.getElementById(id);
var box = document.getElementById(id2);
obj.onclick = function(){
Running(obj,{right:-200},function(){
box.style.display = 'block';
Running(box,{right:10, opacity:100});
});
};
box.onclick = function(){
timer = setTimeout(function(){
Running(box,{right:-220,opacity:0},function(){
box.style.display = 'none';
Flexing(obj,{right:-100});
});
},3000);
};
};
相關(guān)文章
javaScript生成支持中文帶logo的二維碼(jquery.qrcode.js)
這篇文章主要介紹了javaScript生成二維碼,改造jquery.qrcode.js,使之支持中文,能帶logo的二維碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-01-01JS判斷、校驗(yàn)MAC地址的2個(gè)實(shí)例
這篇文章主要介紹了JS判斷、校驗(yàn)MAC地址的2個(gè)實(shí)例,需要的朋友可以參考下2014-05-05超越Jquery_01_isPlainObject分析與重構(gòu)
isPlainObject是Jquery1.4后提供的新方法,用于判斷對(duì)象是否是純粹的對(duì)象(通過(guò) {} 或者 new Object 創(chuàng)建的)。2010-10-10js代碼驗(yàn)證手機(jī)號(hào)碼和電話號(hào)碼是否合法
這篇文章主要介紹了js代碼驗(yàn)證手機(jī)號(hào)碼和電話號(hào)碼是否合法,手機(jī)號(hào)碼和電話號(hào)碼在某些網(wǎng)站都是必填項(xiàng),為了提高用戶體驗(yàn)度,一般要進(jìn)行合法性校驗(yàn)的,需要的朋友可以參考下2015-07-07javascript 中關(guān)于array的常用方法詳解
這篇文章主要介紹了javascript 中關(guān)于array的常用方法的相關(guān)資料,需要的朋友可以參考下2017-05-05