I am having troubles with closing my responsive menu in Ember. Currently I have a menu icon, if someone presses this, the following action fires:
export default Ember.Controller.extend({
actions: {
openMenu() {
$('#menu').toggle();
}
}
});
Which naturally opens my menu. However, when someone presses a link (regardless of where on the page this is) I obviously want the menu to close again. I am finding it difficult how to perform this.
Basically what I want is this:
$('a').click(function() {
$('#menu').hide();
});
But I simply do not know where to place this code.
I have thought about adding a new helper which mimics the Ember linkTo
helper, but I am sure that this would not be the correct solution to the problem. Or is it?
Disclaimer: I am really new to Ember. I use version 2.2 and I do know that they're phasing out controllers, I am working on that too ;).
Aucun commentaire:
Enregistrer un commentaire