모바일 갤러리 리스트 정렬 스크립트 추가 및 view 이미지 리사이즈 스크립트 변경

This commit is contained in:
chicpro
2013-10-02 11:24:27 +09:00
parent 8969f499be
commit a6051aa758
12 changed files with 136 additions and 174 deletions

43
js/viewimageresize.js Normal file
View File

@ -0,0 +1,43 @@
(function($) {
$.fn.viewimageresize = function(selector)
{
var cfg = {
selector: "img"
};
if(typeof selector == "object") {
cfg = $.extend(cfg, selector);
} else {
if(selector) {
cfg = $.extend({ selector: selector });
}
}
var $img = this.find(cfg.selector);
var width = this.width();
function image_resize()
{
$img.each(function() {
$(this).removeAttr("width")
.removeAttr("height")
.css("width","");
if($(this).data("width") == undefined)
$(this).data("width", $(this).width());
if($(this).data("width") > width) {
$(this).css("width", "100%");
}
});
}
$(window).on("load", function() {
image_resize();
});
$(window).on("resize", function() {
image_resize();
});
}
}(jQuery));