/************************************************************************
*************************************************************************
@Name : AdjustZoom - jQuery Plugin
@description: 브라우저 배율이 100% 가 아닌 경우 처리
@Revison : 1.0
@Date : 2015-03-03
@Author : HKP
**************************************************************************
*************************************************************************/
//에디터 페이지 이동 방지
(function($) {
$.AdjustZoom = function(options) {
var option = {
zoomRatio : 100
};
$.extend(option, options);
// 브라우저 배율이 100% 가 아닌 경우 처리
if(screen.logicalXDPI != screen.deviceXDPI) {
try {
// alert(screen.availWidth+", "+screen.logicalXDPI+", "+screen.deviceXDPI);
var ratio = screen.logicalXDPI / screen.deviceXDPI;
var ratio_reverse = screen.deviceXDPI / screen.logicalXDPI;
$('body').css('zoom', ( ratio * option.zoomRatio)+'%');
$('body').width(screen.availWidth * ratio_reverse );
}catch (e) {
alert("브라우저 배율 보정 중 오류가 발생하였습니다. 창을 닫은 후 다시 열어 주시기 바랍니다.");
}
}
};
})(jQuery);
브라우저의 확대/축소 기능을 이용하여 배율을 변경 한 상태에서도 항상 100% 배율로 보일 수 있게 하는 플러그인.
'Dev. 웹 > JavaScript' 카테고리의 다른 글
jQuery element 아름답게 생성하기 (0) | 2015.05.26 |
---|---|
[html5] Web Storage 사용 ( Session Storage, Local Storage ) (0) | 2015.03.04 |
[ jQuery 핵심정리 ] DOM 조작 메서드 (0) | 2014.12.04 |
[jQuery tip] attributes VS properties ( .attr() VS .prop() ) 차이 비교 (0) | 2014.10.28 |
[plugin] 플러그인 소스 - 페이지 로딩, 윈도우 크기 변경 시 선택된 object 위치 이동 (2) | 2014.09.25 |