/** * File navigation.js. * * Handles toggling the navigation menu for small screens and enables TAB key * navigation support for dropdown menus. */ ( function() { var container, button, menu, links, i, len; container = document.getElementById( 'site-navigation' ); if ( ! container ) { return; } button = container.getElementsByTagName( 'button' )[0]; if ( 'undefined' === typeof button ) { return; } menu = container.getElementsByTagName( 'ul' )[0]; // Hide menu toggle button if menu is empty and return early. if ( 'undefined' === typeof menu ) { button.style.display = 'none'; return; } menu.setAttribute( 'aria-expanded', 'false' ); if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { menu.className += ' nav-menu'; } button.onclick = function() { if ( -1 !== container.className.indexOf( 'toggled' ) ) { container.className = container.className.replace( ' toggled', '' ); button.setAttribute( 'aria-expanded', 'false' ); menu.setAttribute( 'aria-expanded', 'false' ); } else { container.className += ' toggled'; button.setAttribute( 'aria-expanded', 'true' ); menu.setAttribute( 'aria-expanded', 'true' ); } }; // Get all the link elements within the menu. links = menu.getElementsByTagName( 'a' ); // Each time a menu link is focused or blurred, toggle focus. for ( i = 0, len = links.length; i < len; i++ ) { links[i].addEventListener( 'focus', toggleFocus, true ); links[i].addEventListener( 'blur', toggleFocus, true ); } /** * Sets or removes .focus class on an element. */ function toggleFocus() { var self = this; // Move up through the ancestors of the current link until we hit .nav-menu. while ( -1 === self.className.indexOf( 'nav-menu' ) ) { // On li elements toggle the class .focus. if ( 'li' === self.tagName.toLowerCase() ) { if ( -1 !== self.className.indexOf( 'focus' ) ) { self.className = self.className.replace( ' focus', '' ); } else { self.className += ' focus'; } } self = self.parentElement; } } /** * Toggles `focus` class to allow submenu access on tablets. */ ( function( container ) { var touchStartFn, i, parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); if ( 'ontouchstart' in window ) { touchStartFn = function( e ) { var menuItem = this.parentNode, i; if ( ! menuItem.classList.contains( 'focus' ) ) { e.preventDefault(); for ( i = 0; i < menuItem.parentNode.children.length; ++i ) { if ( menuItem === menuItem.parentNode.children[i] ) { continue; } menuItem.parentNode.children[i].classList.remove( 'focus' ); } menuItem.classList.add( 'focus' ); } else { menuItem.classList.remove( 'focus' ); } }; for ( i = 0; i < parentLink.length; ++i ) { parentLink[i].addEventListener( 'touchstart', touchStartFn, false ); } } }( container ) ); } )(); $(document).ready(function() { initMaps(); }); $(document).ready(function() { count(".coming-soon"); }); $(".quote-carousel").owlCarousel({ slideSpeed : 300, autoPlay : true, paginationSpeed : 400, singleItem : true, }); $('.counter').counterUp({ delay: 10, time: 1000 }); function count(elem){ var $e = $(elem); if($e.length==0){ return 0; }; var dateOfBeginning = new Date(), dateOfEnd = $e.closest('[data-end-date]').attr('data-end-date') || new Date((new Date()).getTime() + 3*30*24*3600*1000); countDown(dateOfBeginning, dateOfEnd); } var $container = $('.isotope-gallery-container'); var $filter = $('.filter'); $(window).load(function () { // Initialize Isotope $container.isotope({ itemSelector: '.gallery-item-wrapper' }); $('.filter a').click(function () { var selector = $(this).attr('data-filter'); var $iso_container = $(this).closest('.content-block,body').find('.isotope-gallery-container'); $iso_container.isotope({ filter: selector }); var $iso_filter = $(this).closest('.filter'); $iso_filter.find('a').parent().removeClass('active'); $(this).parent().addClass('active'); return false; }); /* $filter.find('a').click(function () { var selector = $(this).attr('data-filter'); $filter.find('a').parent().removeClass('active'); $(this).parent().addClass('active'); });*/ }); $(window).smartresize(function () { $container.isotope('reLayout'); }); $(document).ready(function(){ $('.gallery-zoom').magnificPopup({ type: 'image' // other options }); }); function initMap(elem) { var $e = $(elem); if($e.length==0){ return 0; }; var lat = parseFloat($e.attr('data-map-lat') || 51.5111507); var long = parseFloat($e.attr('data-map-long') || -0.1239844); var zoom = parseInt($e.attr('data-map-zoom') || 15); var marker_image = $e.attr('data-marker-image') || 'images/map-pin.png'; var mapOptions = { center: new google.maps.LatLng(lat, long), zoom: zoom, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.DEFAULT, }, disableDoubleClickZoom: false, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU, }, scaleControl: true, scrollwheel: false, streetViewControl: true, draggable : true, overviewMapControl: false, mapTypeId: google.maps.MapTypeId.ROADMAP, styles: [{stylers:[{saturation:-100},{gamma:1}]},{elementType:"labels.text.stroke",stylers:[{visibility:"off"}]},{featureType:"poi.business",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"poi.business",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"poi.place_of_worship",elementType:"labels.text",stylers:[{visibility:"off"}]},{featureType:"poi.place_of_worship",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{visibility:"simplified"}]},{featureType:"water",stylers:[{visibility:"on"},{saturation:50},{gamma:0},{hue:"#50a5d1"}]},{featureType:"administrative.neighborhood",elementType:"labels.text.fill",stylers:[{color:"#333333"}]},{featureType:"road.local",elementType:"labels.text",stylers:[{weight:0.5},{color:"#333333"}]},{featureType:"transit.station",elementType:"labels.icon",stylers:[{gamma:1},{saturation:50}]}] } var map = new google.maps.Map($e.get(0), mapOptions); var marker = new google.maps.Marker({ icon: marker_image, map: map, position: map.getCenter() }); } function initMaps() { $('.map').each(function(i, e) { initMap(e); }) } $(".headroom").headroom({ }); $(function() { $('.soft-scroll a[href^="#"], a[href^="#"].soft-scroll').bind('click', function(event) { var $anchor = $(this); var href = $anchor.attr('href'); try { var elem = $(href); if(elem.length) { $('html, body').stop().animate({ scrollTop: elem.offset().top }, 1000); event.preventDefault(); } } catch(err) {} }); }); function initHeader3() { $('.nav-slide-btn').click(function() { $('.pull').slideToggle(); }); $('#nav-toggle').click(function(e) { $(this).toggleClass('active'); e.preventDefault(); }) } $(function() { initHeader3(); });