사용자: 게시판 읽기 이미지 등비율 리사이징

This commit is contained in:
whitedot
2012-12-28 17:00:48 +09:00
parent 9a9e7c47c0
commit e1936df6c5
2 changed files with 19 additions and 1 deletions

View File

@ -171,5 +171,20 @@ function file_download(link, file) {
<!-- 게시글 보기 끝 -->
<script>
//이미지등비율리사이즈 스크립트 추가 요망ㅎ
// 이미지 등비율 리사이
$(document).ready(function(){
var img = $('article img');
var img_org_width = img.width();
$(window).resize(function(){
var wrapper_width = $('#wrapper').width();
img.each(function() {
var img_width = $(this).width();
if (img_width > wrapper_width) {
$(this).addClass('img_fix');
} else if (img_width <= wrapper_width && img_width >= img_org_width) {
$(this).removeClass('img_fix');
}
});
}).resize();
});
</script>