есть такой код
$(function(){
// Инициализируем переменные
var action = {}
var imgProp = {}
$.fn.crop_n_wMark = function(opt){
opt = $.extend({
defWidth : '300', //Ширина по-умолчнию(без px)
defHeight : '300', //Высота по-умолчнию(без px)
/*Значения*/
// false - не использовать
// '#000' - цвет (# - обязательно)
// 'img/img.jpg' - путь к изображению
overlay : '', //Слой
overlayOp : '0.5'
}, opt)
action.init = function(el){
if($.browser.webkit){
$(el).find('img').bind('load', function(){
imgProp.i_width = $(this).width(),
imgProp.i_height = $(this).height(),
imgProp.i_path = $(this).attr('src')
})
}
else {
imgProp.i_width = $(el).find('img').width(),
imgProp.i_height = $(el).find('img').height(),
imgProp.i_path = $(el).find('img').attr('src')
}
//return action.appElements(el, imgProp)
}
action.appElements = function(el, obj){
var viewFrame = $('<div id="viewFrame" class="viewFrame"></div>')
var overlay = $('<div id="overlay" class="overlay"></div>')
if(opt.overlay){
var clr = opt.overlay.slice(0,1) //проверяем #
if(clr != '#'){
overlay.css({
backgroundImage : 'url(' + opt.overlay + ')',
backgroundRepeat : 'no-repeat'
})
}
else {
overlay.css({
backgroundImage : 'none',
backgroundRepeat : 'no-repeat',
backgroundColor : opt.overlay
})
}
}
console.dir(obj) //объект со свойствами
console.log(obj.i_width) // undefined... беда...
$(overlay).css({
width: obj.i_width + 'px',
height: obj.i_height + 'px'
}).appendTo($(el))
}
return this.each(function(){
action.init(this)
action.appElements(this, imgProp)
})
}
})
все бы хорошо, но в хроме console.dir(obj) выдает объект со всеми свойствами правильно, а обращение к конкретному свойству obj.i_width выдает undefined. В чем может быть причина?