Skip to content

Instantly share code, notes, and snippets.

@brianpattison
Last active December 25, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianpattison/6977160 to your computer and use it in GitHub Desktop.
Save brianpattison/6977160 to your computer and use it in GitHub Desktop.
<div class="tool-tip">{{title}}</div>
<div class="tool-tip-hover-container">
{{yield}}
</div>
App.ToolTipComponent = Ember.Component.extend({
classNames: ['tool-tip-container'],
didInsertElement: function() {
var self = this;
Ember.run.schedule('afterRender', function() {
self.$('.tool-tip-hover-container').mouseenter(function() {
self.$('.tool-tip').addClass('active');
}).mouseleave(function() {
self.$('.tool-tip').removeClass('active');
});
});
}
});
@stefanpenner
Copy link

seems like the .tool-tip-hover-container should be inserted by the time didInsertElement is called, this means the afterRender is unneeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment