我試圖獲得圖像的尺寸,但得到例如Jquery加載()失敗
Error: Syntax error, unrecognized expression: http://ecx.images-amazon.com/images/I/31Xu1OBZxvL._SL500_AA300_.jpg
代碼我使用第一檢查是否image.display_height
變量是空值或空白,並且如果是的話加載圖像,並得到尺寸。如果失敗隱藏父母。
這裏就是我想:
if(!!image.display_height) {
$(image.preview2).load(function(){
var width = $(this).width();
var height = $(this).height();
}).error(function(){
$(this).parent().hide();
})
}
請提交html代碼。你能看到重複的「!」嗎?在你如果陳述? – 2013-03-05 13:00:40
什麼是「形象」?它在哪裏以及如何定義? – 2013-03-05 13:02:24