jQuery(document).ready(function($){ $(".site-nav-toggle").click(function(){ $(".site-nav").toggle(); }); var stickyTop = function(){ var stickyTop; if ($("body.admin-bar").length) { if ($(window).width() < 765) { stickyTop = 46; } else { stickyTop = 32; } } else { stickyTop = 0; } return stickyTop; } $('.page_item_has_children').addClass('menu-item-has-children'); function fxdHeader(){ var headerPosition = $(".main-header").offset().top; var stickyHeight = stickyTop(); if (headerPosition <= stickyHeight ) $(".main-header").removeClass("fxd-header"); else $(".main-header").addClass("fxd-header"); $('.fxd-header').css({ 'top': stickyHeight }); } $(window).scroll(function(){ $(".main-header").addClass("fxd-header"); fxdHeader(); }); // smooth scroll $(document).on('click', "a.scroll,.site-nav a[href^='#']",function(e){ var selectorHeight = 0; if( !$('.fxd-header').length ) selectorHeight = $('.main-header').outerHeight(); else selectorHeight = $('.fxd-header').outerHeight(); e.preventDefault(); var id = $(this).attr('href'); if(typeof $(id).offset() !== 'undefined'){ var goTo = $(id).offset().top - selectorHeight - stickyTop() + 1; console.log(goTo); $("html, body").animate({ scrollTop: goTo }, 500); } }); $('.comment-form #submit').addClass('btn-normal'); $('.comment-reply-link').addClass('pull-right btn-reply'); $('#back-to-top, .back-to-top').click(function() { $('html, body').animate({ scrollTop:0 }, '800'); return false; }); if ($(window).width() < 920) { $('li.menu-item-has-children').prepend('
'); }else{ $('.site-nav .menu-expand').remove(); } $(window).resize(function() { if ($(window).width() < 920) { $('li.menu-item-has-children').prepend(''); }else{ $('.site-nav .menu-expand').remove(); } }); $(document).on('click','.site-nav .menu-expand', function(){ $(this).siblings('ul').slideToggle(); }); $(".top-carousel").owlCarousel({ responsive:{ 0:{ items:1 }, 600:{ items:2 }, 1000:{ items:3 } } }); $(".cactus-testimonials-carousel").owlCarousel({ items: 1, nav: true }); $(".cactus-clients-carousel").owlCarousel({ responsive:{ 0:{ items:1 }, 400:{ items:2 }, 700:{ items:3 }, 1000:{ items:4 }, 1200:{ items:5 } } }); $(".cactus-slider").owlCarousel({ items: 1 }); });