// load fast click if mobile safari if (navigator.userAgent.match(/(iPhone|iPod|iPad)/i)) { window.addEventListener('load', function() { new FastClick(document.body); }, false); } new View( $('a.view[href]') ); ;(function ($, window, undefined) { 'use strict'; var $doc = $(document), Modernizr = window.Modernizr; /* Backstretch -------------------------------------------------------------- */ if ($('body').attr('id')=='home') { $.backstretch(bgImages, { duration: 10000, fade: 250 }); } // Hide address bar on mobile devices (except if #hash present, so we don't mess up deep linking). if (Modernizr.touch && !window.location.hash) { $(window).load(function () { setTimeout(function () { // At load, if user hasn't scrolled more than 20px or so... if( $(window).scrollTop() < 20 ) { window.scrollTo(0, 1); } }, 0); }); } $(document).ready(function(){ $("body").addClass('ready'); $(this).scrollTop(0); /* Apply show class to main -------------------------------------------------------------- */ var main = $('#main'); main.imagesLoaded(function(){ //main.addClass('show'); }); /* Init scrollpane -------------------------------------------------------------- */ $('.scroll-pane').jScrollPane(); /* Handle mobile nav toggle behaviour -------------------------------------------------------------- */ var sidebar = $('#sidebar'), primaryNav = $('nav#primary'), primaryNavToggle = $('a.toggle', sidebar); primaryNavToggle.click(function(){ primaryNav.toggleClass('active'); sidebar.toggleClass('active'); $(this).toggleClass('collapse'); return false; }); /* Remove filter for ie -------------------------------------------------------------- */ function removeFilter(el) { if (!$.support.opacity && el.style.filter) { try { el.style.removeAttribute('filter'); } catch(smother) {} // handle old opera versions } } /* Secondary navigation -------------------------------------------------------------- */ var secondaryNav = $('nav#secondary ul.secondary'), secondaryNavParents = $('li.parent', secondaryNav); $('a.heading.group', secondaryNav).click(function(){ secondaryNavParents.removeClass('active'); var parent = $(this).parent(); parent.toggleClass('active'); return false; }); /* Fit videos -------------------------------------------------------------- */ $("#main .video").fitVids(); /* Carousel -------------------------------------------------------------- */ $('#slideshow_wrapper').orbit({ animation: 'horizontal-push', // fade, horizontal-slide, vertical-slide, horizontal-push animationSpeed: 800, // how fast animtions are timer: true, // true or false to have the timer resetTimerOnClick: false, // true resets the timer instead of pausing slideshow progress advanceSpeed: 4000, // if timer is enabled, time between transitions pauseOnHover: true, // if you hover pauses the slider directionalNav: true, // manual advancing directional navs captions: true, // do you want captions? captionAnimation: 'fade', // fade, slideOpen, none captionAnimationSpeed: 800, // if so how quickly should they animate in bullets: true, // true or false to activate the bullet navigation fluid: '825x619' // or set a aspect ratio for content slides (ex: '4x3') }); /* Add a limited height class to body for small screens -------------------------------------------------------------- */ var limitedHeight = 700, viewportHeight = $(window).height(); function applyLimitedHeight(viewportHeight) { if (viewportHeight < limitedHeight) { $('body').addClass('limited_height'); } else { $('body').removeClass('limited_height'); } } $(window).resize(function(){ viewportHeight = $(window).height(); applyLimitedHeight(viewportHeight); }); applyLimitedHeight(viewportHeight); /* Handle navigation -------------------------------------------------------------- */ var slideshowCaptions = $('#bg_slideshow .captions ul li'), slideshowControls = $('#bg_slideshow .controls'); $(document).keydown(function(e){ if (e.keyCode == 39) { $('a.next', slideshowControls).trigger('click'); return false; } if (e.keyCode == 37) { $('a.prev', slideshowControls).trigger('click'); return false; } }); $('a', slideshowControls).click(function(e){ if ($(this).hasClass('next')) { $('body').data('backstretch').next(); } else { $('body').data('backstretch').prev(); } return false; }); $(window).on("backstretch.show", function (e, instance) { slideshowControls.addClass('active'); slideshowCaptions.removeClass('active').removeClass('first'); slideshowCaptions.eq(instance.index).addClass('active'); }); }); })(jQuery, this);