$(function() { var $container = $('.gallery'), $containerData = $container.data(); $container.imagesLoaded( function(){ $container.masonry({ itemSelector : '.rgalbum', isAnimated: true, }); if($containerData.galleryId == 'gallery') { var $albumname = $('.albumname'), $img = $('.rgalbum img'); $albumname.each(function(i) { var $imgH = $(this).prevAll($img).height(), $H = $(this).height()+20, $fontSize = parseInt($(this).css('font-size')); $lineHeight = parseInt($(this).css('line-height')); if($H > $imgH) { $(this).css({ 'bottom': "auto", 'top': 0, }); $(this).hover(function() { $(this).stop(true, true).delay(500).animate({ 'top': '-='+($H-$imgH), },($H-$imgH)*10) },function() { $(this).stop(true, true); $(this).css({ 'bottom': "auto", 'top': 0, }); }); } }); $('#orbit_gallery').delegate('.icons-tag','click',function(){ $(this).parents('.gallery_info').nextAll('.albumtag').slideToggle(300, function() { $container.masonry({ itemSelector : '.rgalbum', isAnimated: true, }); }); }); } }); $('.add-imgs').on({ click: function() { $('#fileupload').slideToggle(300, function() { if(!$(this).is(':hidden')) { $('.add-imgs').html(' Close panel'); } else { $('.add-imgs').html(' Add Image'); } }); return false; } }); });