(function ($) {
"use strict";
// Globals
var $window = $(window),
$body = $('body'),
isRtl = $body.hasClass('rtl');
// Helper function to store setting(s) in Storage
var inspiryStoreSettings = function (id, callback) {
if (typeof(Storage) !== "undefined") {
callback(id);
}
};
/*-----------------------------------------------------------------------------------*/
/* Flex Slider
/* You can learn more about its options from http://www.woothemes.com/flexslider/
/*-----------------------------------------------------------------------------------*/
if (jQuery().flexslider) {
// Flex Slider for Home page
$('.home-slider .flexslider').flexslider({
pauseOnAction: false,
smoothHeight: false,
slideshow: true,
slideshowSpeed: 4000,
pauseOnHover: true,
touch: true,
prevText: '',
nextText: '',
controlNav: false,
start: function (slider) {
slider.removeClass('loading');
}
});
/* Gallery slider for home page blog section and blog page */
$('.gallery-slider').flexslider({
animation: "slide",
controlNav: false,
directionNav: true,
pauseOnHover: true,
pauseOnAction: false,
smoothHeight: true,
prevText: '',
nextText: '',
start: function (slider) {
slider.removeClass('loading');
}
});
}
/*---------------------------------------------------------------------------------
* Mean menu for responsive navigation
*--------------------------------------------------------------------------------*/
if (jQuery().meanmenu) {
var $mainNavigation = $("#main-navigation");
$mainNavigation.meanmenu({
meanMenuContainer: '#mobile-navigation',
meanRevealPosition: "left",
meanMenuCloseSize: "20px",
meanScreenWidth: "991",
meanExpand: '+',
meanContract: '-',
meanDisplay: "inline-block"
});
}
/*---------------------------------------------------------------------------------
* Carousels
* http://owlcarousel2.github.io/OwlCarousel2/
*--------------------------------------------------------------------------------*/
if (jQuery().owlCarousel) {
$(".testimonials-carousel").owlCarousel({
rtl: isRtl,
smartSpeed: 800,
autoHeight: true,
responsive: {
0: {
items: 1
},
1199: {
items: 2,
margin: 20
}
}
});
}
/*-----------------------------------------------------------------------------------*/
/* Select 2
/*-----------------------------------------------------------------------------------*/
if ($().select2) {
$('.widget select').select2();
$('.select2').select2();
}
/*-----------------------------------------------------------------*/
/* Sticky Header
/*-----------------------------------------------------------------*/
if ($('body').hasClass('sticky-header')) {
$( '#mobile-sticky').hide();
$(window).on( 'scroll', null, function () {
var $window = $(this);
var $body = $('body');
var $header = $('.sticky-header-wrap');
/* header header top bar and header height */
var headerTopBarHeight = $('.site-header').outerHeight();
/* get the admin bar height */
var adminBarHeight = 0;
if ($body.hasClass('admin-bar')) {
adminBarHeight = 32; // current admin bar height is set to 32px
}
if ($window.width() > 991) { // work only above 991px screen size
if ($window.scrollTop() > headerTopBarHeight) {
$header.fadeIn(300);
$header.css('top', adminBarHeight);
} else {
$header.fadeOut(300);
$header.css('top', 'auto');
}
} else {
$header.css( 'display', 'none' );
var $headerBottom = $( '.site-header-bottom' );
var $headerBottomHeight = $headerBottom.outerHeight();
if ($window.scrollTop() > ( headerTopBarHeight - $headerBottomHeight ) ) {
$headerBottom
.css( 'position', 'fixed')
.css( 'left', '0')
.css( 'width', '100%' )
.css( 'z-index', '99999' )
.css('top', adminBarHeight);
$('.site-header').css( 'height', headerTopBarHeight );
} else {
$headerBottom
.css( 'position', 'relative' )
.css( 'left', 'auto' )
.css( 'width', 'auto' )
.css('top', 'auto');
$('.site-header').css( 'height', 'auto' );
}
}
});
}
})(jQuery);