我正在尝试从 jquery plugins basic book 学习创建插件,但是以下插件不显示图像的高度它总是显示 0 图像高度我应该怎么做才能获得图像高度
(function($) {
jQuery.fn.gallery = function() {
return this.each(function() {
var e = $(this);
console.log(e);
var h = e.height();
console.log(h);
var w = e.width();
// e.height(40);
// e.width(40);
e.click(function() {
console.log(h);
// $('#gal').remove();
e.clone().prependTo("body").center().click(function() {
$(this).remove();
});
});
});
};
})(jQuery);