이미지 리사이즈각 개별 컨텐츠에서 잘 동작하도록 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6372 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2009-05-23 10:22:16 +00:00
parent 2af9763acd
commit bc9f6378aa
2 changed files with 39 additions and 37 deletions

View file

@ -157,48 +157,50 @@ function slideshow(event) {
xScreen.xeShow(); xScreen.xeShow();
} }
$(window).load(function(){ $(document).ready(function(){
var regx_skip = /(?:modules|addons|classes|common|layouts|libs|widgets)/i; var regx_skip = /(?:modules|addons|classes|common|layouts|libs|widgets)/i;
var regx_parent = /(?:document|comment)_[0-9]+_[0-9]+/i; var regx_parent = /(?:document|comment)_[0-9]+_[0-9]+/i;
var xe_content = $(".xe_content"); $(".xe_content").each(function() {
var overflow = xe_content.css("overflow"); $(this).find("img").each(function(){
var width = xe_content.css("width"); var img = $(this);
xe_content.css("overflow","hidden"); var width = img.attr("width");
xe_content.css("width","100%"); if(!width) width = img.width();
var offsetWidth = xe_content.attr("offsetWidth"); img.attr("orig_width",width);
xe_content.css("overflow",overflow); img.attr("width",1);
xe_content.css("width",width); });
var offsetWidth = $(this).width();
// 이미지 목록을 가져와서 리사이즈 $(this).find("img").each(function(){
$(".xe_content img").each(function(){ var img = $(this);
var img = $(this); var src = img.attr("src");
var src = img.attr("src"); img.attr("width",img.attr("orig_width"));
var width = img.attr("width"); img.removeAttr("orig_width",'');
var height = img.attr("height"); var width = img.attr("width");
var height = img.attr("height");
// XE 내부 프로그램 또는 스킨의 이미지라면 이미지 리사이즈를 하지 않음 // XE 내부 프로그램 또는 스킨의 이미지라면 이미지 리사이즈를 하지 않음
if ( regx_skip.test(src) ) return; if ( !regx_skip.test(src) ) {
// 커스텀 속성 추가
img.attr("rel", "xe_gallery");
// 커스텀 속성 추가 // 크기를 계산한다
img.attr("rel", "xe_gallery"); if(width>offsetWidth) {
img.attr("width",offsetWidth-10);
img.attr("height",parseInt(offsetWidth/width*height,10));
}
// 크기를 계산한다 // 링크가 설정되어 있거나 onclick 이벤트가 부여되어 있으면 원본 보기를 하지 않음
if(width>offsetWidth) { if ( !img.parent("a").size() && !img.attr("onclick") ) {
img.attr("width",offsetWidth-1); // 스타일 설정
img.attr("height",parseInt(offsetWidth/width*height,10)); img.css("cursor", "pointer");
}
// 링크가 설정되어 있거나 onclick 이벤트가 부여되어 있으면 원본 보기를 하지 않음 // 클릭하면 슬라이드쇼 시작
if ( !img.parent("a").size() && !img.attr("onclick") ) { img.click(slideshow);
// 스타일 설정 }
img.css("cursor", "pointer"); }
});
// 클릭하면 슬라이드쇼 시작 });
img.click(slideshow);
}
});
}); });
})(jQuery); })(jQuery);

View file

@ -73,7 +73,7 @@ a.bold { font-weight:bold; }
.folder_closer { display: none; } .folder_closer { display: none; }
.folder_area { display: none; } .folder_area { display: none; }
.xe_content { line-height:1.6; } .xe_content { line-height:1.6; overflow:hidden; display:inline;}
.zbxe_widget_output { background:url(../tpl/images/widget_text.gif) no-repeat center bottom; display:block;} .zbxe_widget_output { background:url(../tpl/images/widget_text.gif) no-repeat center bottom; display:block;}