zoukankan      html  css  js  c++  java
  • 点击大图上一张下一张滑过左右图的滑过事件

     /**
        **点击大图事件
        *
        */     
        function getEvent(){
          if(document.all){
            return window.event;
          }
          func=getEvent.caller;
          while(func!=null){
           var arg0=func.arguments[0];
           if(arg0){
            if((arg0.constructor==Event || arg0.constructor ==MouseEvent) || (typeof(arg0)=="object" && arg0.preventDefault && arg0.                 stopPropagation)){
                 return arg0;
               }
             }
           func=func.caller;
           }
           return null;
         }
        function Get_mouse_pos(obj){
          var event=getEvent();
          if(navigator.appName=='Microsoft Internet Explorer'){
            return event.offsetX;
          }else if(navigator.appName=='Netscape'){
              return event.pageX-obj.offsetLeft;
          }
        }
        
        
        function turnover(obj){
          var move_x=Get_mouse_pos(obj);
          var img_width=document.getElementById("imgID").offsetWidth;
          var show_width=img_width;
          if(move_x >= show_width/2){
            obj.style.cursor="URL(../images/next.cur),auto";
            obj.title='下一张';
          obj.onclick=function(){
           $('#rightbt').click();//点击右半边图片的事件
          };                       
          }else{
          obj.style.cursor="URL(../images/pre.cur),auto";
             obj.title='上一张';
          obj.onclick=function(){
           $('#leftbt').click();//点击左半边图片的事件
           }
           }
        }
        
        $("#imgID").mousemove(function(){//imgID图片的id
            turnover(this);
        })

  • 相关阅读:
    scala 基础
    Feign拦截器和解码器
    SpringCloud对使用者透明的数据同步组件
    POI SXSSF API 导出1000万数据示例
    HDFS文件浏览页返回上级目录功能
    Spring Security OAuth2.0
    Spring Security实现OAuth2.0授权服务
    Spring Security实现OAuth2.0授权服务
    Zookeeper学习笔记:简单注册中心
    Eclipse集成Git做团队开发:分支管理
  • 原文地址:https://www.cnblogs.com/dearxinli/p/2834296.html
Copyright © 2011-2022 走看看