How to write the script of JS to realize the effect of picture magnifying glass?
This article mainly introduces "JS to achieve picture magnifying glass effect script how to write", in the daily operation, I believe that many people in JS to achieve picture magnifying glass effect of the script on how to write questions, editor to consult all kinds of information, sort out a simple and easy-to-use method of operation, hope to answer the "JS to achieve picture magnifying glass effect script how to write" doubt! Next, please follow the editor to study!
The complete source code is as follows:
Picture magnifying glass-(yisu.com) * {margin:0px; padding:0px;} # left {width:350px; height:350px; float:left Border:1px solid # cccccc; margin-top:10px; margin-left:10px; position:relative;} # right {border:1px solid # cccccc; float:left Position:relative; width:350px; height:350px; display:none; overflow:hidden; margin-top:10px } # right img {position:absolute;} # small {width:150px; height:150px; background-color:#F90 Border:1px solid # cccccc; opacity:0.3; top:0px; position:absolute; cursor:move; display:none } # left img {width:100%; height:100%;}
$(document) .ready (function (e) {$("# left") .mousemove (move) .mouseenter (function () {$("# small"). Show (); $("# right"). Show ()}) .mouseleave (function () {$("# small"). Hide (); $("# right"). Hide ()})) Function move (e) {var y = e.pageY-$("# left") .offset () .top; if (y > = 75 & & y = 75 & x