>  기사  >  웹 프론트엔드  >  웹 페이지 오른쪽의 일시 중단된 스크롤 온라인 QQ 고객 서비스 코드 예_javascript 기술

웹 페이지 오른쪽의 일시 중단된 스크롤 온라인 QQ 고객 서비스 코드 예_javascript 기술

WBOY
WBOY원래의
2016-05-16 16:50:531490검색

웹 페이지 오른쪽에 QQ 온라인 고객 서비스 코드 스크롤 중단

웹 페이지 오른쪽의 일시 중단된 스크롤 온라인 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[이름];
 }else{
  return getCompulatedStyle(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));
   };
   var speed=(json[attr]-now)/5;
   speed=speed>0? Math.ceil(속도):Math.floor(속도);
   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 속성){
   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 타이머 = 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(){
  실행 중(obj,{right:-200},function(){
   box.style.display = 'block';
   실행 중(box,{right:10, 불투명도: 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으로 문의하세요.