最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于jquery編寫的放大鏡插件

 更新時(shí)間:2016年03月23日 15:04:05   作者:前端小家鳥  
這篇文章主要為大家詳細(xì)介紹了基于jquery編寫的放大鏡插件,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了自己動(dòng)手實(shí)現(xiàn)的jquery放大鏡插件,供大家參考,具體內(nèi)容如下

/**
  ***********************************************
  **此插件使用須知---------------       **
  **濾鏡(inner)與其活動(dòng)區(qū)(active)之比要等于 **
  **放大區(qū)(movequ)與其內(nèi)部圖片之比。如比值不相 **
  **等,請(qǐng)改變圖片大小.------------------------**
  **參數(shù)介紹                  **
  **active:濾鏡活動(dòng)區(qū)             **
  **inner:濾鏡                 **
  **movequ:放大區(qū)域              **
  **需在Html頭部引入本js腳本及jquery-1.8.3腳本 **
  **如有疑問,請(qǐng)聯(lián)系QQ:64047399,為你解答   **
  ***********************************************
 
**/
 
 
$.fn.extend({
  yangbo:function(active,inner,movequ){
    $(active).hover(function(){
      $(inner).show();
      $(movequ).show();
      var proportionOne=$(active).width()/$(inner).width();
      var proportionTwo=$(movequ).find('img').width()/$(movequ).width();
      // console.log($(movequ).find('img').width());
      if(proportionOne==proportionTwo){
      $(this).mousemove(function(event){
        //以下為右側(cè)放大
        var proportionLeft=$(active).width()/$(inner).width();
        var proportionTop=$(active).height()/$(inner).height();
        $(movequ).scrollLeft($(inner).position().left*proportionLeft).scrollTop($(inner).position()
        .top*proportionTop);
 
        //以下為小濾鏡拖拽
        $(inner).offset({
            left:event.pageX-40,
            top:event.pageY-40
          });
 
        //以下為判斷臨界值
        if($(inner).position().left<=0){
            $(inner).css({
              left:0
            })
          }
          if($(inner).position().top<=0){
            $(inner).css({
              top:0
            })
          }
          if($(inner).position().left>=$(this).width()-$(inner).width()){
            $(inner).css({
              left:$(this).width()-$(inner).width()
            })
          }
          if($(inner).position().top>=$(this).height()-$(inner).height()){
            $(inner).css({
              top:$(this).height()-$(inner).height()
            })
          }
 
      })
    }else{
      $(active).text('圖片寬高不正確:請(qǐng)調(diào)整圖片寬高-->濾鏡與其父親之比應(yīng)該等于右側(cè)盒子與右側(cè)圖片之比')
      .css({
        background:'yellow',
        color:'red',
      });
    }
  },function(){
      $(inner).hide();
      $(movequ).hide();
    })
 
 
  }
 
})

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評(píng)論

敦化市| 玉树县| 平山县| 霞浦县| 民勤县| 浑源县| 甘谷县| 洛扎县| 冀州市| 堆龙德庆县| 湘潭县| 芜湖市| 闸北区| 尚志市| 高陵县| 利津县| 舒城县| 兴安盟| 富顺县| 永新县| 佳木斯市| 阿克苏市| 佛教| 沅陵县| 凌源市| 四川省| 包头市| 资源县| 沙田区| 衡阳县| 和政县| 衡阳市| 都兰县| 尚义县| 新野县| 延川县| 肇东市| 祁阳县| 勐海县| 安泽县| 临泉县|