function get_sticky_header(){ if ( jQuery(window).scrollTop() > 50 ) { jQuery('nav.navbar-default').addClass('sticky'); } else { jQuery('nav.navbar-default').removeClass('sticky'); } } (function($){ "use strict"; var $window = $(window); $window.on( 'load', function () { $("#status").fadeOut(); $("#preloader").delay(350).fadeOut("slow"); $("body").delay(350).css({ "overflow": "visible" }); /* Preloader */ $("#status").fadeOut(); $("#preloader").delay(350).fadeOut("slow"); /* END of Preloader */ }); // Add class if menu has desctiption jQuery('#responsive-menu li').each(function(){ if( jQuery('nav #navbar').hasClass( 'has-menu-description' ) ){ return false; } if( jQuery(this).find('a span').hasClass('sub') ){ jQuery('nav #navbar').addClass( 'has-menu-description' ); jQuery('nav #navbar').removeClass( 'has-no-menu-description' ); } else { jQuery('nav #navbar').addClass('has-no-menu-description'); } }); var $main_header = $('.main_h'); // If parent menu has submenu then add down arrow jQuery('#responsive-menu > li').each(function(){ if( jQuery(this).find('ul').hasClass('sub-menu') ){ jQuery(this).find('ul:first').prev('a').find('.eb_menu_title').append(''); } }); $(window).on( 'scroll' , function(event) { event.preventDefault(); // IF page template is sticky get_sticky_header(); }); // Mobile Navigation $('.mobile-toggle').on( 'click' , function(event) { event.preventDefault(); if ($main_header.hasClass('open-nav')) { $main_header.removeClass('open-nav'); } else { $main_header.addClass('open-nav'); } }); $('.main_h li a').on( 'click' , function(event) { event.preventDefault(); if ($main_header.hasClass('open-nav')) { $('.navigation').removeClass('open-nav'); $main_header.removeClass('open-nav'); } }); // contact form $(document).on( 'submit' , '#main-contact-form1', function(e){ e.preventDefault(); $.ajax({ url: "mail/contact.php", type: 'POST', data: $('#main-contact-form1').serialize(), success: function(msg){ $( '#mail_success_message' ).empty().html( msg ).show(); }, }); return; }); $(' #da-thumbs > li ').each( function() { $(this).hoverdir(); }); /** * Slicknav - a Mobile Menu */ var $slicknav_label; $('#responsive-menu').slicknav({ duration: 500, closedSymbol: '', openedSymbol: '', prependTo: '#slicknav-mobile', allowParentLinks: true, label:"" }); // Mouse-enter dropdown $('#navbar li').on("mouseenter", function() { $(this).find('ul').first().stop(true, true).delay(350).slideDown(500); }); // Mouse-leave dropdown $('#navbar li').on("mouseleave", function() { $(this).find('ul').first().stop(true, true).delay(100).slideUp(150); }); /** * Arrow for Menu has sub-menu */ if ($(window).width() > 992) { $(".navbar-arrow ul ul > li").has("ul").children("a").append(""); } $(document).ready(function() { $('.progress .progress-bar').css("width", function() { return $(this).attr("aria-valuenow") + "%"; } ) }); $(window).on( 'scroll' , function(){ if($(window).scrollTop() > 500){ $("#back-to-top").fadeIn(200); } else{ $("#back-to-top").fadeOut(200); } }); $(document).on("click",'#back-to-top a',function() { $('html, body').animate({ scrollTop:0 },'slow'); return false; }); })(jQuery); // Photo gallery instagram style jQuery(function($) { var updateArrows = function(){ $('.carouselGallery-right').removeClass('disabled'); $('.carouselGallery-left').removeClass('disabled'); var curIndex = $('.carouselGallery-carousel.active').data('index'); updateArrows.nbrOfItems = updateArrows.nbrOfItems || $('.carouselGallery-carousel').length -1; curIndex === updateArrows.nbrOfItems && $('.carouselGallery-right').addClass('disabled'); curIndex === 0 && $('.carouselGallery-left').addClass('disabled'); } $('.carouselGallery-carousel').on('click', function(e){ scrollTo = $('body').scrollTop(); $('body').addClass('noscroll'); $('body').css('position', 'fixed'); $('.carouselGallery-col-1, .carouselGallery-col-2').removeClass('active'); $(this).addClass('active'); showModal($(this)); updateArrows(); }); $('body').on('click', '.carouselGallery-right, .carouselGallery-left', function(e){ if($(this).hasClass('disabled')) return; var curIndex = $('.carouselGallery-carousel.active').data('index'); var nextItemIndex = parseInt(curIndex+1); if($(this).hasClass('carouselGallery-left')){ nextItemIndex-=2; } var nextItem = $('.carouselGallery-carousel[data-index='+nextItemIndex+']'); // console.log(nextItemIndex); if(nextItem.length > 0){ $('.carouselGallery-col-1, .carouselGallery-col-2').removeClass('active'); $('body').find('.carouselGallery-wrapper').remove(); showModal($(nextItem.get(0))); nextItem.first().addClass('active'); } updateArrows(); }); var modalHtml = ''; showModal = function(that){ // console.log(that); var username = that.data('username'), location = that.data('location'), imagetext = that.data('imagetext'), likes = that.data('likes'), imagepath = that.data('imagepath'), carouselGalleryUrl = that.data('url'); postURL = that.data('posturl'); maxHeight = $(window).height()-100; if ($('.carouselGallery-wrapper').length === 0) { if(typeof imagepath !== 'undefined') { modalHtml = "
"; modalHtml += "
"; modalHtml += "
"; modalHtml += ""; modalHtml += "
"; modalHtml += "carouselGallery image"; modalHtml += "
"; modalHtml += "
"; modalHtml += ""+username+" " modalHtml += ""+location+""; modalHtml += ""; modalHtml += "

"+imagetext+"

"; modalHtml += "
"; $('body').append(modalHtml).fadeIn(2500); } } }; $('body').on( 'click','.carouselGallery-wrapper', function(e) { if($(e.target).hasClass('.carouselGallery-wrapper')){ removeModal(); } }); $('body').on('click', '.carouselGallery-modal .iconscircle-cross', function(e){ removeModal(); }); var removeModal = function(){ $('body').find('.carouselGallery-wrapper').remove(); $('body').removeClass('noscroll'); $('body').css('position', 'static'); $('body').animate({scrollTop: scrollTo}, 0); }; // Avoid break on small devices var carouselGalleryScrollMaxHeight = function() { if ($('.carouselGallery-scrollbox').length) { maxHeight = $(window).height()-100; $('.carouselGallery-scrollbox').css('max-height',maxHeight+'px'); } } $(window).resize(function() { // set event on resize clearTimeout(this.id); this.id = setTimeout(carouselGalleryScrollMaxHeight, 100); }); document.onkeydown = function(evt) { evt = evt || window.event; if (evt.keyCode == 27) { removeModal(); } }; $('.blog-listing').matchHeight(); $('.comment-reply-link').addClass('btn-sm btn btn-primary'); }); function getTestimonialScrollbar( selector ){ var custom = new scrollbot( selector ); setScrollStyles(custom); } function setScrollStyles(custom3){ custom3.setStyle({height:2}); var onscrollfollower = document.createElement("div"); onscrollfollower.style.width = "100%"; onscrollfollower.style.height = "100%"; onscrollfollower.style.backgroundColor = "#222222"; onscrollfollower.style.position = "absolute"; onscrollfollower.style.bottom = "100%"; onscrollfollower.style.right = 0; custom3.scrollBarHolder.appendChild(onscrollfollower); custom3.onScroll(function(){onscrollfollower.style.bottom = 100 - parseFloat(this.scrollBar.style.top) + "%";}) } // Search in header. jQuery(document).on('click','.search-icon', function(e){ e.preventDefault(); jQuery('.search-box-wrap').slideToggle(); });