I had to make some simple slideDown animation within a View (that should ONLY run on desktop) and was wondering if there’s a “better” way than this approach.
//this goes in the router, i'm aware globals are bad.
_device_ = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/);
App.IndexView = Em.View.extend({
didInsertElement: function() {
if(!__device__){
this.$('#alertbar').hide().fadeIn(300);
}
}
});
The latter might be a little faster. You could benchmark, but I suspect it doesn’t make much of a difference. I would decide which reads better to you and is more maintainable and go with that.