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.