首頁  >  文章  >  web前端  >  網頁右側懸浮滾動線上qq客服程式碼範例_javascript技巧

網頁右側懸浮滾動線上qq客服程式碼範例_javascript技巧

WBOY
WBOY原創
2016-05-16 16:50:531490瀏覽

網頁右側懸浮滾動QQ線上客服代碼

網頁右側懸浮滾動線上qq客服程式碼範例_javascript技巧

複製程式碼 程式碼如下:

函數 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 oParent = document.getElementById(id);
 var oParent = document.getElementById(id);
 var oParent = oParent.getElementsByTagName('*');
 var array = [];
for (var i=0; i  if (all[i].className = = sClass){
   array.push(all[i]);
  };
 };
 回備用;
};
 if(obj.currentStyle){
  return obj.currentStyle[name];
 }else{
  return getCompulatedStyle(objfalse{
  return getCompulatedStyle(objfalse)[false>;
function Running(obj,json,fnEnd){
 clearInterval(obj.timer);
 obj.timer=setInterval(function(){
  var now=0Stop;  for (var attr in json){
   if(attr=='opacity'){
    now=Math.round(parseFloat(getStyle(obj,,attr)   }else{
    now=parseInt(getStyle(obj,attr));
   };
   var speed(json[attr]-now);
   var speed=(json[attr]-now);
  Math.ceil(speed):Math.floor(speed);
   if(now!=json[attr])bStop=false;
   if(attr=='opacity'){
    if(attr=='opacity'){
    if(attr=='opacity'){
  .filter='alpha(opacity:'現在速度')';
    obj.style.opacity=(現在速度)/100;
   }else{
  px';
   };
  }
  if(bStop){
   clearInterval(obj.timer); 30);
}
函數Flexing(obj,json,fnEnd){
 clearInterval(obj.timer);
 obj.timer=setInterval(function(){ ;
  var bStop=true;
  for (var attr in json){
   if(!obj.speed)obj.speed={};
  attif(!obj.speed. 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; attr]*=0.85;
    var MaxSpeed=65;
    if(Math.abs(obj.speed[attr])>MaxSpeed){
   >0?MaxSpeed:-MaxSpeed;
    };
    obj.style[attr]=now obj.speed[attr] 'px'; o>; ){
   clearInterval(obj.timer);
   obj.style[attr]=json[attr] 'px';
   if(fnEnd)fnEnd();}
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 obj = document.getElementById(id);
 varobjbox = document.getElementById(id2);
 obj.style.top = box.style.top = top 'px';
};
function dealy(id,time ){
 var obj = document.getElementById(id);
 var timeout = setTimeout(function(){
  Flexing(obj,{right:-100});
 },time*1000 );
}; 🎜>函數click_fn(id,id2){
 var obj = document.getElementById(id);
 var box = document.getElementById(id2);
 obj.onclick = ftion( Running(obj,{right:-200},function(){
   box.style.display = 'block';
   Running(box,{right:10, 不透明度: 100});  Running(box,{right:10, 不透明度: 100});  Running(box,{right:10, 不透明: 100});  });
 };
 box.onclick = function(){
  計時器= setTimeout(function(){
   Running(box,{right:-220,opacuncity:0}    Running(box,{right:-220,opacuncity:0}, (){
    box.style.display = 'none';
    Flexing(obj,{right:-100});
   });   
  },3000);
};
};


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn