ホームページ  >  記事  >  ウェブフロントエンド  >  Web ページの右側にある中断されたスクロール オンライン QQ カスタマー サービスのコード例_JavaScript スキル

Web ページの右側にある中断されたスクロール オンライン QQ カスタマー サービスのコード例_JavaScript スキル

WBOY
WBOYオリジナル
2016-05-16 16:50:531490ブラウズ

Web ページの右側にある QQ オンライン カスタマー サービス コードのスクロールが一時停止されました

Web ページの右側にある中断されたスクロール オンライン QQ カスタマー サービスのコード例_JavaScript スキル

コードをコピー コードは次のとおりです:

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 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 (json の var attr){
if(attr=='opacity'){
now=Math.round(parseFloat(getStyle(obj,attr))*100);
}else{
now=parseInt(getStyle(obj,attr));
};
varspeed=(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:' 現在の速度 ')';
obj.style.opacity=(現在の速度)/100;
}else{
obj.style[attr]=現在の速度 ' 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 (json の var attr){
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 の数と QQ 番号的数不符,请設置5个QQ番号!nn[設置未成功!]');
return;
}else{
for (var i=0; i obj[i].innerHTML = "点击咨询";
};
};
};
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);
};
};
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。