// Script
(function($)
{
jQuery(document).ready(function($) {
$('.nav_wrapper').height($('.site-header').height()); //flickering issue in gallery post
$(document).on('click', '.js-toggleSidebar', function(){
$('.breeze-sidebar').toggleClass('sidebar-closed');
$('.sidebar-overlay').fadeToggle( 320 ); //sidebar
});
// Back to top
$('#back-to-top').on('click', function(){
$("html, body").animate({scrollTop: 0}, 500);
return false;
});
// pre loader
function preloader(immune, background, color) {
$("body").prepend('
');
if (immune == true) {
$("body > div.preloader").addClass('immune');
}
if (background == 'white') {
$("body > div.preloader").addClass('white');
}
else if (background == 'black') {
$("body > div.preloader").addClass('black');
}
if (color == 'green') {
$("body > div.preloader span.loading-bar").addClass('green-colored');
$("body > div.preloader i.radial-loader").addClass('green-colored');
}
$(window).load(function() {
setTimeout(function() {
$('.preloader').fadeOut(1000);
}, 1000);
setTimeout(function() {
$('.preloader').remove();
}, 2000);
})
};
preloader(true, 'black', 'green');
function fixButtonHeights() {
var heights = new Array();
// Loop to get all element heights
$('.breeze-blog-colums .post').each(function() {
// Need to let sizes be whatever they want so no overflow on resize
$(this).css('min-height', '0');
$(this).css('max-height', 'none');
$(this).css('height', 'auto');
// Then add size (no units) to array
heights.push($(this).height());
});
// Find max height of all elements
var max = Math.max.apply( Math, heights );
// Set all heights to max height
$('.breeze-blog-colums .post').each(function() {
$(this).css('height', max + 'px');
// Note: IF box-sizing is border-box, would need to manually add border and padding to height (or tallest element will overflow by amount of vertical border + vertical padding)
});
}
$(window).load(function() {
// Fix heights on page load
fixButtonHeights();
// Fix heights on window resize
$(window).resize(function() {
// Needs to be a timeout function so it doesn't fire every ms of resize
setTimeout(function() {
fixButtonHeights();
}, 120);
});
});
});
})(jQuery);