Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function(){
- $.fn.randomize = function(childElem) {
- return this.each(function(){
- var $this = $(this);
- var elems = $this.children(childElem);
- elems.sort(function(){return (Math.round(Math.random()) - 0.5); });
- $this.remove(childElem);
- for(var i=0; i < elems.length; i++)
- $this.append(elems[i]);
- })
- };
- var $container = $("#container");
- $container.imagesLoaded(function(){
- $container.randomize(".item").masonry({
- itemSelector: '.item',
- columnWidth: function(containerWidth){
- return containerWidth / 4;
- }(),
- isAnimated: true
- });
- $(".item img.not-loaded").trigger("scroll");
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement