$(window).load(function(){
alert(typeof $.fn.init_deps);
});
$(document).ready(function(){
/* Departments switcher */
$.fn.init_deps = function(s){
var o = {
deps:false,
cats:false
}
$.extend(o,s);
if(!s.deps || !s.cats) {return;}
return this.each(function(){
var select = $('<select id="department" name="department"></select>')
.appendTo(this)
.departments(s)
.change(function(){
var select = $('select#category');
select.categories({cats:s.cats,current_dep:$(this).val()});
var p_width = select.parent().outerWidth();
var ch_width = select.outerWidth();
select.parent().css('width',p_width+'px')
.find('select').css('width',(ch_width + 8)+'px')
.parent().find('span').css('width',(p_width - 20)+'px');
$.uniform.update(select);
});
var p_width = select.parent().outerWidth();
var ch_width = select.outerWidth();
select.uniform({selectClass:'selector uni1'})
.parent().css('width',p_width+'px')
.find('select').css('width',(ch_width + 8)+'px')
.parent().find('span').css('width',(p_width - 20)+'px');
});
}
});
Alert returns undefined in IE7, but in all other browsers it returns function.
Help, can’t figure out where is problem.
window onload probably fires before the function is bound in IE. You should define the $.fn before document ready.