Created
February 3, 2014 22:31
-
-
Save ninegrid/8793814 to your computer and use it in GitHub Desktop.
an ember view for masonry
This file contains 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
var MasonicView = Ember.View.extend({ | |
didInsertElement: function() { | |
this.scheduleMasonry(); | |
}, | |
scheduleMasonry: (function() { | |
Ember.run.scheduleOnce('afterRender', this, this.applyMasonry); | |
}), | |
applyMasonry: function() { | |
setTimeout(function() { | |
this.$('.bricks').masonry({ | |
itemSelector: '.brick', | |
columnWidth: 0, | |
gutter: 0 | |
}); | |
},100); | |
}, | |
contentDidChange: function() { | |
if(this.get("state") === "inDOM") { | |
this.applyMasonry(); | |
} | |
} | |
}); | |
export default MasonicView; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment