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

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

@ -9,6 +9,9 @@ form, img {border:0}
input, img {vertical-align:middle}
p {margin:10px 0;line-height:1.5em}
/* 이미지 등비율 리사이징 */
.img_fix {float:left;width:100%;height:auto}
/* 내용 건너뛰기 */
#to_content a {display:block;position:absolute;top:0;left:0;margin:5px;height:0;text-decoration:none;overflow:hidden}
#to_content a:focus,

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>