jQuery(document).ready(function($){ //$('#content, .wrap').fitvids(); /* var example = $('header #nav').superfish({ speed : 'fast' }); */ $('.product-slider').flexslider({ animation: "slide", animationLoop: true, itemWidth: 150, //itemMargin: 10, minItems: 2, maxItems: 5, controlNav: false, directionNav: true }); $(".popup, .fancybox").fancybox({ maxWidth : '85%', maxHeight : '85%', type : 'iframe' }); $(".popup-download, .popup-chat").fancybox({ maxWidth : '700', maxHeight : '90%', minHeight : '300', type : 'iframe', 'autoscale' : true }); $(".popup-image").fancybox({ maxWidth : '500', maxHeight : '80%', type : 'image' }); $(".validate").validate( ); // Show header search box $("#nav li.search a").on('click', function() { //$("#nav").addClass("hidden"); $("#nav #searchform").fadeIn(0); $("#nav #searchform #text").focus(); }); // Hide header search box on click outside $(document).mouseup(function (e) { var container = $("#nav #searchform"); if (!container.is(e.target) && container.has(e.target).length === 0) {// ... nor a descendant of the container container.hide(); //$("#nav").removeClass("hidden"); } }); // HIDDEN FORM - GET STARTED $(".show-form").click( function(){ frm_id = $(this).attr('data-form-id'); if ( frm_id ) { //alert(frm_id); $(".frm-"+frm_id).slideToggle(200); } else { $(".pop-form").slideToggle(200); } return false; }); $(".pop-form #close").click( function(){ $(this).parent().parent().parent().slideUp(200); }); /***** Mobile Nav *******/ et_duplicate_menu( $('#nav'), $('header .mobile_nav'), 'mobile_menu', 'et_mobile_menu' ); function et_duplicate_menu( menu, append_to, menu_id, menu_class ){ var $cloned_nav; menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( append_to ); $cloned_nav = append_to.find('> ul'); //$cloned_nav.find('.menu_slide').remove(); $cloned_nav.find('li:first').addClass('et_first_mobile_item'); append_to.click( function(){ if ( $(this).hasClass('closed') ){ $(this).removeClass( 'closed' ).addClass( 'opened' ); $cloned_nav.slideDown( 500 ); } else { $(this).removeClass( 'opened' ).addClass( 'closed' ); $cloned_nav.slideUp( 500 ); } return false; } ); append_to.find('a').click( function(event){ event.stopPropagation(); } ); } jQuery.fn.anchorAnimate = function(settings) { settings = jQuery.extend({ speed : 1100, margin: 0 }, settings); return this.each(function(){ var caller = this jQuery(caller).click(function (event) { event.preventDefault() var locationHref = window.location.href var elementClick = jQuery(caller).attr("href") var destination = jQuery(elementClick).offset().top - settings.margin; jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() { window.location.hash = elementClick }); return false; }) }) } $("a.anchor").anchorAnimate({ speed : 500, margin: 0 }) });