A magnifying glass plugin based on jquery _jquery

Source: Internet
Author: User
Tags html header

This example for you to share your own hands-on jquery magnifying glass plug-ins for your reference, the specific contents are as follows

/** *********************************************** * * * This plug-in use notice---------------* * * * FILTER (inner) and its active area (active) ratio is equal to * * * * * * magnification area (movequ) and its internal picture ratio. If the ratio is not * * * * * * *, please change the size of the picture.------------------------* * * * **active: Filter Activity Area * * **inner: Filter   Mirror * * * **movequ: Enlarge Area * * * need to introduce this JS script and jquery-1.8.3 script in the HTML header * * * * * * * * If you have questions, please contact qq:64047399, for your answer * * *********************************************** **/$.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) {//below is the right magnified Var proportionleft=$ (
        Active). Width ()/$ (inner). width (); var proportiontop=$ (Active). Height ()/$ (inner). Height (); $ (movequ). ScrollLeft ($ (inner). Position (). Left*proportionleft). ScrollTop ($ (inner). Position (). Top*proportiontop)
 
        ;
 
        The following is a small filter drag $ (inner). Offset ({left:event.pagex-40, top:event.pagey-40}); 
          The following is a critical value 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). h 
          Eight ()-$ (inner). Height ()) {$ (inner). CSS ({top:$ (this). Height ()-$ (inner). Height ()})
        })}else{$ (active). Text (' picture width is not correct: Please adjust the picture width height--> filter and its father's ratio should be equal to the right side of the box and the right picture of the ratio '). CSS ({ backgRound: ' Yellow ', Color: ' Red ',};
      }},function () {$ (inner). Hide ();
    $ (movequ). Hide ();
 })
 
 
  }
 
})

The above is the entire content of this article, I hope to help you learn.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.