-
-
Save trek/6030144 to your computer and use it in GitHub Desktop.
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
.ember-view .tooltip { | |
display:none; | |
} | |
.ember-view.tip-visible .tooltip { | |
display:block; | |
} |
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
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'); | |
} | |
}); |
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
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a cool technique, but IMO I don't think Ember users should be confined to this.