/*
*
* JQUERY의 단순 돋보기 플러그인-JNMagnifier
* 작성자:날개의 원래 의도
* QQ:4585839
* 날짜:2011-11-16
*
*/
( 함수($){
$.fn.JNMagnifier=함수(설정){
if(setting&&setting.renderTo){
if(typeof(setting.renderTo)==" string"){
settings.renderTo = $(setting.renderTo);
}
}else{
return;
}
var _img_org_ = this.children("img" );
_img_org_.css("cursor","pointer");
var __h = 0;
this.offset().left; >var __top = this.offset ().top;
if(this.offsetParent())
{
__left =this.offsetParent().offset().left; .offsetParent().offset( ).top;
}
var _move_x = 0;
var _move_y = 0
var _val_w = (setting.renderTo.width() / 2); 🎜>var _val_h = (설정 .renderTo.height() / 2);
_img_org_.mouseover(function(){
setting.renderTo.html('
')
setting.renderTo.show()
var 타이머 = setInterval(){
__w = $("#JNMagnifierrenderToImg ").width() / _img_org_.width();
__h = $("#JNMagnifierrenderToImg").height() /_img_org_.height(); 0){
clearInterval(타이머);
}
},100)
})
_img_org_.mouseout(function(){
setting.renderTo.hide() ;
});
_img_org_.mousemove(function(e){
_move_x =0-Math.round((document.documentElement.scrollLeft e.clientX-__left) * __w - _val_w);
_move_y =0-Math.round((document.documentElement.scrollTop e.clientY-__top) * __h - _val_h)
$("#JNMagnifierrenderToImg").css({"left":_move_x "px", "top":_move_y "px "});
});
}
})(jQuery)
호출 방법: