I'm having trouble with cross-browser compatibilty with a jQuery click function. I want it to return the width of #bbox and have it play the animations based on what it returns. I have set the width of #bbox to 0px in my CSS as the starting state.
THE PROBLEM: w returns as 0px as the starting state in Firefox, but in Chrome and IE it returns fractions of a pixel, which screws everything up. Has anyone encountered this type of thing before?
$('div').on('click', '#browse', function() {
var w = $("#bbox").css('width');
if (w != '0px' && w != '0') {
$("#bbox").stop().animate({'width': '0', 'opacity': '0'}, function(){
$("#bbox").css({'z-index': '0', 'display': 'none'});
})
}
else {
$("#bbox").animate({'width': '550px', 'opacity': '1'}, function(){
$(document).one('click', function(){
$("#bbox").stop().animate({'width': '0', 'opacity': '0'}, function(){
$("#bbox").css({'z-index': '0', 'display': 'none'});
});
})
$('#bbox').click(function(event){
event.stopPropagation();
})
})
.css({'z-index': '1', 'display': 'block'});
}
})