To make it easier to read i put everything under the initialize
function.
Is there something wrong here? The alert gets triggered so it's not the condition.
I have the share actions hidden and would like to show them on Hover on desktop and Tap on mobile given the hover impossibility.
Am I missing something here?
console.log()
doesn't throw any errors.
App.Views.Title = Backbone.View.extend({
initialize:function(){
_.bindAll(this,"stickToTop");
this.template = _.template($("#title").html());
this.render();
$(window).scroll(this.stickToTop);
var isMobile = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/);
var share = this.$(".share");
if(isMobile){
// alert('mobile')
share.on('click' , this.shareMobile , this);
}else{
// alert('not mobile')
share.on('hover' , this.shareDesktop , this);
}
},
...