orbit-basic/app/assets/javascripts/lib/gallery.js

59 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

$(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('<i class="icons-cross-2"></i> Close panel');
} else {
$('.add-imgs').html('<i class="icons-plus"></i> Add Image');
}
});
return false;
}
});
});