-
Notifications
You must be signed in to change notification settings - Fork 33
$().foundation() loads too early. #25
Comments
+1 |
Solved it putting this code in my controller: init: function () {
this._super();
Ember.run.schedule("afterRender",this,function() {
$(document).foundation();
});
}, |
Or, e.g. I created wrapper component for content area like this: // app/components/application-area.js
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
this.$().foundation();
}
}); and |
@GCheung55 @williamweckl Is this just a 2.5.x issue? have you updated to anything more recent? |
I ended up creating a wrapper component like @SlyDen's example. I don't think it was an issue with ember-cli v2.5. I think this can be closed. |
Where is the controller located? |
@Jumokee I think @williamweckl was referring to a controller that corresponded to the template that had needed the Foundation JS. So you could create an |
Thanks @williamweckl, I'm trying this in top-level application controller, and getting no luck. Ember does schedule it for afterRender, but it still seems to get called before those elements are in the DOM. Manually calling it in the console works just fine. Thoughts? Not sure why the Ember run loop isn't as intuitive as it seems... isn't afterRender a global event (as in, waits for everything to load, even children). |
Similar to @SlyDen, I just dropped a component
This seems to work, until you render anything afterwards. You may have to do as @SlyDen does, but always wrap relevant foundation markup inside the component yield. |
As @allthesignals mentioned it won't work if you "add new HTML to the DOM" ... I faced with it recently.
Of course, it can be better solution than "afterRender" but it works without warnings ... |
On ember-cli 2.5.1. $().foundation() is triggered by the initializer but it's not doing anything.
I have a component template that has the example responsive header from Foundation 6 Site docs:
The only way I've made it work was to go into web console and type
$(document).foundation();
I've tried creating my own initializers/zf-widget.js with
$(document).foundation();
and, while that line of code is executed, the menu isn't working correctly. Nothing is hidden and the dropdowns are still expanded.My
ember-cli-build.js
looks like:The text was updated successfully, but these errors were encountered: