我的代码:
(function($){
$.fn.extend({
popupbox: function(options) {
//Settings list and the default values
var defaults = {
photo_url : "",
photo_id : ""
};
var options = $.extend(defaults, options);
return this.each(function() {
var o = options;
//Assign current element to variable
var obj = $(this);
var photo_pic = $('#photo_box_img');
photo_pic.attr("src", o.photo_url);
photo_pic.load(function() {
var pic_width = photo_pic.width();
var pic_height = photo_pic.width();
console.log(pic_width);
}
});
}
});
})(jQuery);
第一次click
image
click() function
按住next time
中的上述按钮,它返回 0 但shows
proper width
{{1}} {{1}} ......为什么会这样做?