-
-
Save hqman/5335651 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var down = "touchup" in window ? "touchup" : "click"; | |
var abstractView = Backbone.View.extend({ | |
// we don't want both click and touch handlers | |
// delegated on touch-enabled devices | |
events: function () { | |
"click .toggler" : "foo", | |
"touchup .toggler" : "bar" | |
}, | |
initialize: function () { | |
// we can do this instead | |
this.events = this.events || {}; | |
this.events[down + ' .toggler'] = "foo"; | |
// … list more events here | |
this.delegateEvents(); | |
} | |
}); | |
// This does solve the problem but this doesn't look good | |
// | |
// We could do something like jQuery special event, but Zepto, | |
// that is used on mobile devices doesn't support special events | |
// | |
// So seamless "down .toggler" : "foo", that would work by registering | |
// "special" jQuery event will not work with Zepto |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment