이미지 등비율 리사이즈 스크립트 수정
This commit is contained in:
@ -176,19 +176,27 @@ function board_move(href)
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 이미지 등비율 리사이징
|
// 이미지 등비율 리사이징
|
||||||
$(function(){
|
$(window).load(function() {
|
||||||
var img = $('#bo_v_img img');
|
view_image_resize();
|
||||||
var img_org_width = img.width();
|
|
||||||
$(window).resize(function(){
|
|
||||||
var img_wrap = $('#bo_v_img').width();
|
|
||||||
img.each(function() {
|
|
||||||
var img_width = $(this).width();
|
|
||||||
if (img_width > img_wrap) {
|
|
||||||
$(this).addClass('img_fix');
|
|
||||||
} else if (img_width <= img_wrap && img_width >= img_org_width) {
|
|
||||||
$(this).removeClass('img_fix');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).resize();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(window).resize(function(){
|
||||||
|
view_image_resize();
|
||||||
|
});
|
||||||
|
|
||||||
|
function view_image_resize()
|
||||||
|
{
|
||||||
|
var $img = $('#bo_v_img img');
|
||||||
|
var img_wrap = $('#bo_v_img').width();
|
||||||
|
|
||||||
|
$img.each(function() {
|
||||||
|
var img_width = $(this).width();
|
||||||
|
$(this).data("width", img_width); // 원래 이미지 사이즈
|
||||||
|
if (img_width > img_wrap) {
|
||||||
|
$(this).addClass('img_fix');
|
||||||
|
} else if (img_width <= img_wrap && img_width >= $(this).data("width")) {
|
||||||
|
$(this).removeClass('img_fix');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
Reference in New Issue
Block a user