/* Display Mobile Menu */ $(document).ready(function(){ $("#mobile-icon-menu").click(function(){ $("#lower_bar").slideToggle(); }); }); /* Display Mobile Menu Sub Nav */ $(document).ready(function(){ if($(window).width() <= 980){ //only works on screensizes smaller than main body width (in this case 980px) $("#pages-list > li:nth-child(4)").click(function(){ $("#pages-list > li:nth-child(4) > ul").slideToggle(); }); } }); /* Popup Contact Form Function */ $(document).ready(function() { //waits until the DOM has finished loading if ($('a.formTrigger').length){ //checks to see if there is a lightbox trigger on the page $('a.formTrigger').each(function(){ //for every lightbox trigger on the page var url = $(this).attr("href"); // sets the link url as the target div of the lightbox $(url).hide(); //hides the lightbox content div $(this).colorbox({ inline:true, // so it knows that it's looking for an internal href href:url, // tells it which content to show width:"336", height:"553", onOpen:function(){ //triggers a callback when the lightbox opens $(url).show(); //when the lightbox opens, show the content div }, onCleanup:function(){ $(url).hide(); //hides the content div when the lightbox closes } }).attr("href","javascript:void(0)"); //swaps the href out with a javascript:void(0) after it's saved the href to the url variable to stop the browser doing anything with the link other than launching the lightbox when clicked }) } }); /*Colorbox Responsive Sizing*/ jQuery.colorbox.settings.maxWidth = '100%'; /* jQuery.colorbox.settings.maxHeight = '100%'; */ // 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, true); /* Scroll to Top Function */ $(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; }); });