나는 여러 가지 이미지 태그를 갖고 있으며 아래 HTML과 같이 div로 구성되어 있습니다. Google 크롬에서 이미지 크기를 가져 오는 것이 정의되지 않았습니다.
내 requirment으로는 높이 * 폭 < 5000 1) 2) 제거 correspponding div의 제거이 * 각 이미지의 너비를 높이를 계산하고 다음을 수행 할 것이다 correcsponding 이미지의 '캡 티브'
IE 용과 파이어 폭스 용으로 작동하기 때문에 아래의 스크립트를 사용해 보았습니다. ethod.
$('img[class = "captify"]').each(function(){
var $that = $(this),
picRealWidth = 0,
picRealHeight = 0,
imgSize = 0,
dvHiResCaption = null,
src = $that.attr('src'),
rel = $that.attr('rel');
// creating a clone in memory
$('<img/>').attr('src', src)
.load(function(){
picRealWidth = parseInt(this.width);
picRealHeight = parseInt(this.height);
}, function(){
// called once the load is complete
imgSize = picRealWidth * picRealHeight;
if(imgSize < 5000){
dvHiResCaption = '#' + rel;
$(dvHiResCaption).remove();
$that.removeClass('captify');
}
});
});
아무에게도 도움이 될 수 없습니까? 미리 감사드립니다.
당신은있어 그 코드에서 너무 많이 :) –