/** * Child JS. * * Child JS scripts. * * @since 1.0.0 */ $(document).ready(function () { if($('.bottomedge').length != 0) { $('.pageBread').addClass('ctaHover'); } // you want to enable the pointer events only on click; $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none on doc ready $('#canvas1').on('click', function () { $('#map_canvas1').removeClass('scrolloff'); // set the pointer events true on click }); // you want to disable pointer events when the mouse leave the canvas area; $("#map_canvas1").mouseleave(function () { $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none when mouse leaves the map area }); // Footer Location Modal $('#exampleModal').on('show.bs.modal', function (event) { var button = $(event.relatedTarget) // Button that triggered the modal var recipient = button.data('whatever') var street = button.data('street') var city = button.data('city') var phone = button.data('phone') var weekHours = button.data('week-hours') var satHours = button.data('sat-hours') var sunHours = button.data('sun-hours') var dataFax = button.data('fax') var directionsLink = button.data('directions-link') var locationBg = button.data('location-bg') var modal = $(this) modal.find('#modal-title').text(recipient) modal.find('#modal-street').text( street ) modal.find('#modal-city').text( city ) modal.find('#modal-phone').text( phone ) modal.find('#modal-weekHours').text( weekHours ) modal.find('#sat-hours').text( satHours ) modal.find('#sun-hours').text( sunHours ) modal.find('#fax').text( dataFax ) modal.find('#directions-link').attr( "href", directionsLink ) modal.find('.locationPopup .popupBody').css( "background", locationBg ) }) // Awards Slider - Homepage $('.awards-slider').carousel({ interval: 6000, keyboard: true }) $(".awards-slider").swipe({ swipe: function(event, direction, distance, duration, fingerCount, fingerData) { if (direction == 'left') $(this).carousel('next'); if (direction == 'right') $(this).carousel('prev'); }, allowPageScroll:"vertical" }); $('#myCarousel').carousel({ interval: 4000 }); // handles the carousel thumbnails $('[id^=carousel-selector-]').click( function(){ var id_selector = $(this).attr("id"); var id = id_selector.substr(id_selector.length -1); id = parseInt(id); $('#myCarousel').carousel(id); $('[id^=carousel-selector-]').removeClass('selected'); $(this).addClass('selected'); }); // when the carousel slides, auto update $('#myCarousel').on('slid', function (e) { var id = $('.item.active').data('slide-number'); id = parseInt(id); $('[id^=carousel-selector-]').removeClass('selected'); $('[id=carousel-selector-'+id+']').addClass('selected'); }); }); $(document).ready(function() { $(".mobile-dropdown-link").on('click', function(){ $(".mobile-dropdown").slideToggle("fast"); }); }); $(function () { $('a[href="#search"]').on('click', function(event) { event.preventDefault(); $('#search').addClass('open'); $('#search > form > input[type="search"]').focus(); }); $('#search, #search button.close').on('click keyup', function(event) { if (event.target == this || event.target.className == 'close' || event.keyCode == 27) { $(this).removeClass('open'); } }); $('#utilityBar .search-btn form').submit(function(event) { // event.preventDefault(); // return false; }) }); $(document).ready(function() { // $('.announcement-banner-image').remove().insertAfter($('.cd-timeline-block')) var timelineImg = $('.cd-timeline-title-container+img').prop('src'); //alert(timelineImg); $('.cd-timeline-title-container+img').closest(".cd-timeline-content").after(''); $('.cd-timeline-title-container+img').remove(); }); $(document).ready(function() { var windowsize = $(window).width(); $(window).resize(function() { var windowsize = $(window).width(); }); // Custom var stickyToggle = function(sticky, stickyWrapper, scrollElement) { var stickyHeight = sticky.outerHeight(); var stickyTop = stickyWrapper.offset().top; if (scrollElement.scrollTop() >= stickyTop){ stickyWrapper.height(stickyHeight); sticky.addClass("is-sticky"); } else{ sticky.removeClass("is-sticky"); stickyWrapper.height('auto'); } }; if (windowsize > 991) { // Find all data-toggle="sticky-onscroll" elements $('[data-toggle="sticky-onscroll"]').each(function() { var sticky = $(this); var stickyWrapper = $('
').addClass('sticky-wrapper'); // insert hidden element to maintain actual top offset on page sticky.before(stickyWrapper); sticky.addClass('sticky'); // Scroll & resize events $(window).on('scroll.sticky-onscroll resize.sticky-onscroll', function() { stickyToggle(sticky, stickyWrapper, $(this)); }); // On page load stickyToggle(sticky, stickyWrapper, $(window)); }); } else { $('nav.navbar').css("position", "static"); } $(function() { // hardwood $('#navBar li#menu-hardwood').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-hardwood.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); // carpet $('#navBar li#menu-carpet').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-carpet.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); // laminate $('#navBar li#menu-laminate').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-laminate.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); // vinyl $('#navBar li#menu-vinyl').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-vinyl.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); // tile $('#navBar li#menu-tile').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-tile.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); // vacuum $('#navBar li#menu-vacuum').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-miele.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); // rug $('#navBar li#menu-rugs').hover(function() { $('#megaLiveImg').css('background', 'url("https://d3fq9trs5x2hk.cloudfront.net/wp-content/uploads/2017/01/megamenu-area-rug.jpg")'); }, function() { // on mouseout, reset the background colour $('#megaLiveImg').css('background', ''); }); }); // Sticky Header /** * trigger the dim sticky on scroll */ jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > 60){ jQuery('#colesNav').addClass("fixed"); } else{ jQuery('#colesNav').removeClass("fixed"); } }); /** * mobile menu */ jQuery('#nav-expander').on('click', function() { console.log('hello'); jQuery('#mobileMenu nav').addClass('mobileActive'); }); jQuery('#nav-close').on('click', function() { jQuery('#mobileMenu nav').removeClass('mobileActive'); }); });