Last active
March 7, 2017 14:43
-
-
Save robertdavid010/dc77aa4430ace94258147316f798bf3a to your computer and use it in GitHub Desktop.
Description of DOM event binding in Meteor Blaze
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
| /* | |
| Here we put the code so it is accessible app wide (assuming it's bound to <body>. | |
| This also assumes both the FlowRouter package and the gwendall:body-events fix package. | |
| */ | |
| if (Meteor.isClient) { | |
| Template.body.events({ | |
| "click [data-nav]": function (event, templ) { | |
| event.preventDefault(); | |
| FlowRouter.go(event.currentTarget.dataset.nav); | |
| }, | |
| "click [data-href]": function (event, templ) { | |
| event.preventDefault(); | |
| var url = event.currentTarget.dataset.href; | |
| window.open(url, '_blank'); | |
| window.focus(); | |
| } | |
| }); | |
| } |
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
| /* Make the mouse pointer behaves like as if a normal clickable element */ | |
| [data-nav], [data-href], [data-event] { | |
| cursor: pointer; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment