> 웹 프론트엔드 > JS 튜토리얼 > 블로그 네트워크에서 효과를 차감했습니다_이미지 특수효과

블로그 네트워크에서 효과를 차감했습니다_이미지 특수효과

WBOY
풀어 주다: 2016-05-16 19:12:55
원래의
1137명이 탐색했습니다.

블로그 웹사이트에서 효과를 추출했는데, 알 수 없는 부분이 있어 Wuyouqiang에게 연구를 도와달라고 요청했습니다.
지금 데모하기: http://www.iyumen.cn/TopUser.asp
효과 설명: 아바타에 마우스를 올리면 아바타가 자동으로 다른 사진으로 변환됩니다. 제 홈페이지에는 gif, jpg 두 가지 형식의 이미지가 있기 때문에 이제 원본 이미지가 jpg이면 문제가 없습니다. gif이면 실제로는 아바타가 업로드되지 않았다는 메시지가 뜹니다. , 있지만 js에는 gif를 가져올 수 있는 설정이 없습니다.

그래서 제가 원하는 기능은 다른 사진으로 변경하지 않고 사진 위에 마우스를 올려놓는 것입니다. ?

전문가가 쉽게 다운로드하고 수정할 수 있도록 이 페이지에 포함된 소스 코드를 압축 패키지로 만들었습니다. 어쩌면 내가 그것을 매우 명확하게 설명하지 않았을 수도 있습니다.

코드 복사 코드는 다음과 같습니다.


function oo(obj){
        return typeof(obj)=="string"?document.getElementById(obj):obj
}

var eet,eel,bid,dh;
var state=0;
var showi=0;

function asdf_list(sign,id,user){
var xid=id.substr(0,id.length-5)

    bid=id;
    e=oo(bid)
 // alert(name)
    var et=e.offsetTop;
    var el=e.offsetLeft;
    while(e=e.offsetParent){
        et+=e.offsetTop;
        el+=e.offsetLeft;
    }
    eet=et;
    eel=el;

    if(sign==1){
        if(showi==0){
            if(el<780){
//alert("<780")
oo("navigation_logo").style.right="";
oo("navigation_logo").style.left=(el+119) + "px";
oo("navigation_logo").style.top=(et-3) + "px";
var imgtanchuhtml2="
"
               imgtanchuhtml2 +="
"

                oo("imgtanchu").innerHTML=imgtanchuhtml2;
                oo("ll").src="http://www.iyumen.cn/images/imgs/avatar_border.gif"
                oo("lr").src="http://www.iyumen.cn/images/imgs/avatar_border2.gif"
                    oo("showlogoimg").innerHTML=" + user + " + user ;
                oo("link_1").innerHTML="去" + user + "的个人主页";

                if(loginstate==0){

                    oo("link_3").innerHTML="给" + user + "发短消息";
                }else{
                    oo("link_3").innerHTML="给" + user + "发短消息";
                }
                oo("link_4").innerHTML="查看" + user + "的评论列表";
                    oo("oDiv").style.top=(et-3) + "px";
                    oo("oDiv").style.left=(el-3) + "px";
                    oo("oDiv").style.display='';
            }else{
           // alert(">780")
                hw = oo("home").scrollWidth - el;
                oo("navigation_logo").style.left="";
                oo("navigation_logo").style.right=(parseInt(hw)+parseInt(10)) + "px";
                oo("navigation_logo").style.top=(et-3) + "px";
                oo("navigation_logo").style.left;
                var imgtanchuhtml="
"
                imgtanchuhtml +="
"
               oo("imgtanchu").innerHTML=imgtanchuhtml;
                oo ("arrow_img").style.Background="url(http://www.iyumen.cn/images/imgs/avatar_left.gif) 상위 반복-x; #ff0000;"
               oo("ll").src="http://www.iyumen.cn/images/imgs/avatar_border2.gif"
               oo("lr").src="http: //www.iyumen.cn/images/imgs/avatar_border.gif"
                   oo("showlogoimg").innerHTML=""   user ;
               oo("link_1") .innerHTML="去"   사용자   "적주류"
              if(loginstate==0){

oo("link_3").innerHTML="给"   사용자   "发短消息"
               }else{
                   oo("link_3").innerHTML="给"   사용자   "发短消息";
               }
              oo("link_4").innerHTML="查看"   사용자   "적의评论列表";
                oo("oDiv").style.left=(el-10)   "px";
               oo("oDiv").style.top= (et-3)   "px";
              oo("oDiv").style.display='';
           }
       state=1
    }else(sign= =2){
        상태=0;
    }
}


함수 asdfg(sign){
    if(sign==1){
        oo( "oDiv").style.display=''
        state=1;
    }else if(sign==2){
        if(oo("navigation_logo").style.display==' none'){
           oo("oDiv").style.display='none';
        }
        state=0;
    }
}

function asdfg_left( sign){
    if(sign==1){
        oo("oDiv").style.display=''
        state=1;
    }else if(sign==2) {
        if(oo("navigation_logo").style.display=='none'){
           oo("oDiv").style.display='none'
        }
        state= 0;
    }
}

기능 asdfgh(sign,id){
    if(sign==1){
        oo("navigation_logo").style.display='';
        상태=1;
   }else if(sign==2){
        state=0;
    }
}

함수 showarrow(sign){
    if(sign==1){
        if(oo("navigation_logo").style.display=='none '){
            oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_right.gif')";
        }
    }else if(sign==2){
        if(oo("navigation_logo").style.display=='none'){
           if(oo("arrow_img") .style.Background=="url(http://www.iyumen.cn/images/imgs/avatar_left.gif)"){
               oo("arrow_img").style.Background="url('http: //www.iyumen.cn/images/imgs/avatar_right.gif')";
            }else{
                oo("navigation_logo").style.display='none';
               oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_right.gif')";
            }
        }else{
            oo("navigation_logo").style.display='';
            if(oo("navigation_logo").style.display=='none'){
               oo("arrow_img").style.Background="url('http://www.iyumen.cn/ 이미지/imgs/avatar_right.gif')";
           }
        }
    }
}

function disnav(){
   var dis=oo("navigation_logo").style.display;
   if(dis=="none"){
       oo("navigation_logo").style.display='';
       oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_left.gif')";
       ssh=sh 50;
       showi=1;
   }else{
       oo("navigation_logo").style.display='none';
       oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_right.gif')";
       showi=0;
   }
}

function disnav2(){
   var dis=oo("navigation_logo").style.display;
   if(dis=="none"){
       oo("navigation_logo").style.display='';
       oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_right.gif')";
       ssh=sh 50;
       showi=1;
   }else{
       oo("navigation_logo").style.display='none';
       oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_left.gif')";
       showi=0;
   }
}

var obj=document.getElementById("d")
var t=new Object();
함수 show(){
    obj.style.display="";
    obj.style.width=document.body.clientWidth;
    obj.style.height=document.body.clientHeight;
    if(obj.filters.alpha.opacity>25){
        obj.filters.alpha.opacity=25;
        clearTimeout(t.timer1);
        반품;
    }else{
        obj.filters.alpha.opacity =2;
        t.timer1=setTimeout("show()",10)
    }
    return;
}
함수 hide(){
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
          if(obj.filters.alpha.opacity<=0){
        obj.filters.alpha.opacity=0;
        obj.style.display="none"
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        t.timer2=setTimeout("hide()",5);
        }
      }else{
       obj.style.display="none"
      }
    반환;
}


var sPop = null;
var postSubmited = false;
var smdiv = new Array();

var userAgent = navigator.userAgent.toLowerCase();
var is_webtv = userAgent.indexOf('webtv') != -1;
var is_kon = userAgent.indexOf('konqueror') != -1;
var is_mac = userAgent.indexOf('mac') != -1;
var is_saf = userAgent.indexOf('applewebkit') != -1 || navigator.vendor == 'Apple Computer, Inc.';
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko' && !is_saf) && userAgent.substr(userAgent.indexOf('firefox')   8, 3);
var is_ns = userAgent.indexOf('호환') == -1 && userAgent.indexOf('mozilla') != -1 && !is_opera && !is_webtv && !is_saf;
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera && !is_saf && !is_webtv) && userAgent.substr(userAgent.indexOf('msie')   5, 3);

var sw,sh;
sw=document.body.clientWidth
sh=document.body.clientHeight

var obj=document.getElementById("dssss")
var t=new Object();
함수 show(){
    var   screet=eet-300;
    scrollTo(0,screet);
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
    obj.style.display="";
    oo("info_dsss").style.left=(document.body.offsetWidth-400)/2 "px";


    oo("info_dsss").style.top=eet "px";


    oo("info_dsss").style.display="";
    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";

    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    if(obj.filters.alpha.opacity>60){
        obj.filters.alpha.opacity=60;
        clearTimeout(t.timer1);
        반품;
    }else{
        obj.filters.alpha.opacity =2;
        show()
    }
    반환;
    }else{

    obj.style.Background="url(http://www.iyumen.cn/images/imgs/reg-pop-bg2.png)";
    obj.style.display="";
    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    oo("info_dsss").style.left=(document.body.offsetWidth-400)/2 "px";
    oo("info_dsss").style.top=eet "px";
    oo("info_dsss").style.display="";

    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";
    }
}

function show_out(){
        scrollTo(0,0);
      if (window.navigator.userAgent.indexOf("MSIE")>=1){

    obj.style.display="";

    oo("quit-alert").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("quit-alert").style.top="200px";
    oo("quit-alert").style.display="";
    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";

    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    if(obj.filters.alpha.opacity>60){
        obj.filters.alpha.opacity=60;
        clearTimeout(t.timer1);
        반품;
    }else{
        obj.filters.alpha.opacity =2;
        show_out()
    }
    반환;
    }else{
    obj.style.Background="url(http://www.iyumen.cn/images/imgs/reg-pop-bg2.png)";
    obj.style.display="";
    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;
    oo("quit-alert").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("quit-alert").style.top="200px";
    oo("quit-alert").style.display="";

    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";
    }
}

function in_party(){
        scrollTo(0,0);
      if (window.navigator.userAgent.indexOf("MSIE")>=1){

    obj.style.display="";

    oo("in_party").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("in_party").style.top="200px";
    oo("in_party").style.display="";
    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";

    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    if(obj.filters.alpha.opacity>60){
        obj.filters.alpha.opacity=60;
        clearTimeout(t.timer1);
        반품;
    }else{
        obj.filters.alpha.opacity =2;
        in_party()
    }
    반환;
    }else{
    obj.style.Background="url(http://www.iyumen.cn/images/imgs/reg-pop-bg2.png)";
    obj.style.display="";
    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;
    oo("in_party").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("in_party").style.top="200px";
    oo("in_party").style.display="";

    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";
    }
}

function hide_in(){
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
           if(obj.filters .alpha.opacity<=0){
        obj.filters.alpha.opacity=0;
        obj.style.display="none"

        oo("in_party").style.display="none"
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        hide_in()
        }
      }else{
       obj.style.display="none"
       oo("in_party").style.display="none"
      }
    oo("in_party").style.top="200px";
      반품;
}

function show_black(){
        scrollTo(0,0);
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
    obj.style.display="";
    oo("quit-black").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("quit-black").style.top="200px";
    oo("quit-black").style.display="";
    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";

    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    if(obj.filters.alpha.opacity>60){
        obj.filters.alpha.opacity=60;
        clearTimeout(t.timer1);
        반품;
    }else{
        obj.filters.alpha.opacity =2;
        show_black();
    }
    반품;
    }else{
    obj.style.Background="url(http://www.iyumen.cn/images/imgs/reg-pop-bg2.png)";
    obj.style.display="";
    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    oo("quit-black").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("quit-black").style.top="200px";
    oo("quit-black").style.display="";
    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";
    }
}

function show_add(){
        scrollTo(0,0);
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
    obj.style.display="";

    oo("add-alert").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("add-alert").style.top="200px";
    oo("add-alert").style.display="";
    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";

    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;

    if(obj.filters.alpha.opacity>60){
        obj.filters.alpha.opacity=60;
        clearTimeout(t.timer1);
        반품;
    }else{
        obj.filters.alpha.opacity =2;
        show_add();
    }
    반품;
    }else{
    //      alert("ssdd")
    obj.style.Background="url(http://www.iyumen.cn/images/imgs/reg-pop-bg2.png) )";
    obj.style.display="";
    //obj.style.width=document.body.clientWidth;
    //obj.style.height=document.body.clientHeight;


    oo("add-alert").style.left=(document.body.offsetWidth-300)/2 "px";
    oo("add-alert").style.top="200px";
    oo("add-alert").style.display="";

    obj.style.width=oo("home").scrollWidth "px";
    obj.style.height=oo("home").scrollHeight "px";
    //alert(obj.style.width)
    }
}

function show_login(){
             scrollTo(0,0);
         oo("login-out").style.display="";
         oo("login-pop").style.display="";
}

function show_login2(){
        oo("oDiv").style.display="none";
            oo("navigation_logo").style.display="none";
            oo("arrow_img").style.Background="url('http://www.iyumen.cn/images/imgs/avatar_right.gif')";
            showi=0;
            scrollTo(0,0);
        oo("login-out").style.display="";
        oo("login-pop").style.display=""
}

function hide(){
      if (window.navigator.userAgent.indexOf("MSIE") >=1){
           if(obj.filters.alpha.opacity<=0){
        obj.filters.alpha.opacity=0;
        obj.style.display="none"

        oo("info_dsss").style.display="none"
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        hide()
        }
      }else{
       obj.style.display="none"
       oo("info_dsss").style.display="none"
      }
    반품;
}

함수 hide_login(){
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
          if(obj.filters.alpha.opacity< ;=0){
        obj.filters.alpha.opacity=0;
        obj.style.display="none"

        oo("login-out").style.display="none";
        oo("login-pop").style.display="none";
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        hide_login()
        }
      }else{
       obj.style.display="none"
       oo("login-out").style.display="none";
       oo("login-pop").style.display="none";
      }
    oo("login-out").style.top="95px";

      반품;
}



function hide_out(){
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
           if(obj .filters.alpha.opacity<=0){
        obj.filters.alpha.opacity=0;
        obj.style.display="none"

        oo("quit-alert").style.display="none"
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        hide_out()
        }
      }else{
       obj.style.display="none"
       oo("quit-alert").style.display="none"
}
    oo("quit-alert").style.top="200px";
      반품;
}

함수 hide_add(){
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
          if(obj.filters.alpha.opacity<=0) {
        obj.filters.alpha.opacity=0;
        obj.style.display="none"

        oo("add-alert").style.display="none"
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        hide_add()
        }
      }else{
       obj.style.display="none"
       oo("add-alert").style.display="none"
}
    oo("add-alert").style.top="200px";
      반품;
}

함수 hide_black(){
      if (window.navigator.userAgent.indexOf("MSIE")>=1){
          if(obj.filters.alpha.opacity< ;=0){
        obj.filters.alpha.opacity=0;
        obj.style.display="none"

        oo("quit-black").style.display="none"
        clearTimeout(t.timer2)
        return;
        }else{
        obj.filters.alpha.opacity-=2;
        hide_black();
        }
      }else{
       obj.style.display="none"
       oo("quit-black").style.display="none"
      }
    oo( "quit-black").style.top="200px";
      반품;
}

function login_url(op,partyid,groupid,styles){

    var loghref=location.href ;
    oo("login_url").innerHTML="";
    actinfo(op);
    setday(partyid,groupid,styles);
}
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿