Skip to content

Instantly share code, notes, and snippets.

@trek
Forked from gfranko/example.js
Last active December 19, 2015 22:48
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 trek/6030144 to your computer and use it in GitHub Desktop.
Save trek/6030144 to your computer and use it in GitHub Desktop.
.ember-view .tooltip {
display:none;
}
.ember-view.tip-visible .tooltip {
display:block;
}
App = Ember.Application.create();
App.ImageWithTooltip = Ember.View.extend({
classNames: ['container'],
classNameBindings: ['tipVisible'],
tipVisible: false,
mouseEnter: function(){
this.toggleProperty('tipVisible');
},
mouseLeave: function(){
this.toggleProperty('tipVisible');
}
});
<script type="text/x-handlebars" data-template-name="example">
<div class="main-container">
<h2>Pick Your Character:</h2>
<div class="row-fluid">
{{view App.ImageWithTooltip src="./imgs/someImage.png"}}
{{view App.ImageWithTooltip src="./imgs/someImage.png"}}
</div>
</div>
</script>
<script type="text/x-handlebars" data-template-name="imageWithTooltip">
<img {{bindAttr src="view.src"}} />
<div class='tooltip'></div>
</script>
@gfranko
Copy link

gfranko commented Jul 18, 2013

This is a cool technique, but IMO I don't think Ember users should be confined to this.

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