/* Display Mobile Menu */ $(document).ready(function(){ if($(window).width() <= 1020){ //only works on screensizes where mobile menu is present (in this case 1020px) $("#lower_bar_2").click(function(){ $("#pages-list").slideToggle(); $(this).toggleClass("open"); }); } }); /* Disable Menu Linkl for Sub-Navigation */ $('#pages-list > li:nth-child(3) > a').replaceWith(function(){ return $('' + $(this).html() + ''); }); /* Display Menu Sub Nav */ $(document).ready(function(){ $("#pages-list > li:nth-child(3) > a, #pages-list > li:nth-child(3) > span").click(function(){ $("#pages-list > li:nth-child(3) > ul").toggle("fast"); }); }); /* Add Class to List Item on Click */ $("#pages-list > li:nth-child(3) > a").click(function(){ $(this).toggleClass("active"); }); /* Add Navigation Links for Class Times & Details */ $('').insertAfter('#pages-list > li:nth-child(3) > ul > li:first-child > a'); /* Display Third Level Sub Nav */ $(document).ready(function(){ $("#pages-list > li:nth-child(3) > ul > li:first-child").click(function(){ $("#third-level-nav").toggle("fast"); }); }); /*Window Scroll Function*/ $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 1) { $("#lower_bar").addClass("light-nav"); } else { $("#lower_bar").removeClass("light-nav"); } if (scroll >= 1) { $("#siteHeader").addClass("small-logo"); } else { $("#siteHeader").removeClass("small-logo"); } }); /* Scroll to Page Anchor */ $(function(){ $('a[href*="#"]:not([href="#"])').click(function() { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 1000); return false; } }); }); /* Scroll to Top */ $(document).ready(function(){ $(window).scroll(function(){ if ($(this).scrollTop() > 100) { $('.scrollup').fadeIn(); } else { $('.scrollup').fadeOut(); } }); $('.scrollup').click(function(){ $("html, body").animate({ scrollTop: 0 }, 600); return false; }); }); /* Add Current Date */ var months = ['January','February','March','April','May','June','July', 'August','September','October','November','December']; var tomorrow = new Date(); tomorrow.setTime(tomorrow.getTime() + (1000*3600*24)); document.getElementById("spandate").innerHTML = tomorrow.getFullYear(); /* Add Container Class to Contact Form */ $( "#form42" ).addClass( "container" ); /*Window Height to Equal Viewport Height*/ var vHeight = $(window).height(), cover = $('#wizzy45'); cover.css({"height":vHeight}); /*Enable Colorbox Video*/ $(document).ready(function(){ $(".popup-video").colorbox({iframe:true, innerWidth:800, innerHeight:450}); }); /*Colorbox Responsive Sizing*/ jQuery.colorbox.settings.maxWidth = '90%'; jQuery.colorbox.settings.maxHeight = '90%'; // ColorBox resize function var resizeTimer; function resizeColorBox() { if (resizeTimer) clearTimeout(resizeTimer); resizeTimer = setTimeout(function() { if (jQuery('#cboxOverlay').is(':visible')) { jQuery.colorbox.load(true); } }, 300); } // Resize ColorBox when resizing window or changing mobile device orientation /* jQuery(window).resize(resizeColorBox); */ window.addEventListener("orientationchange", resizeColorBox, false);