jQuery(function($) { Avenue.settings['init_functions'].push(function($html) { $html.find(".fancybox").fancybox({ titleShow: false, helpers: { overlay: { locked: false } } }); $html.find('[data-av-switch-img-full]').hover(function () { $html.find('[data-av-primary-img] img').attr('src', $(this).attr('data-av-switch-img-small')); $html.find('[data-av-primary-img]').attr('href', $(this).attr('data-av-switch-img-full')); }); $html.find('[data-av-primary-img]').click(function(e) { var url = $(this).attr('href'); var target = $('.fancybox[href="' + url + '"]:first'); if (target[0]) { target.click(); } e.preventDefault(); }); }); Avenue.settings['init_functions'].push(function($html) { $html.find('.no-js-hide').removeClass('no-js-hide'); }); // It's important this happens AFTER the no-js-hide init function is added because // the bxslider init function can't be called on something which is {display: none;} Avenue.set_style('bootstrap3'); Avenue.init({}); // Add a 'data-toggle=collapse-next' argument $('body').on('click.collapse-next.data-api', '[data-toggle=collapse-next]', function (e) { var $target = $(this).next(); $target.hasClass('in') ? $target.collapse('hide') : $target.collapse('show'); e.preventDefault(); }); // jQuery UI Stars initialisation. This also exist on one of the drops, but it really shouldn't $("#stars-wrapper1").stars({ split: 2, callback: function(ui, type, value){ $("#review_rating").val(value); } }); $(function () { $('[data-toggle="tooltip"]').tooltip() }); // Search bar show/hide for mobile $(function() { $('.open-mobile-search').click(function () { $('.navbar-collapse').hide(); // hide the dropdown menu $('.top-mobile-search-hide').fadeIn("slow"); // show search form $('.open-mobile-search').css('color','#1a2674'); // recolor search icon $('.av-search-input-mobile').focus(); // focus input to show keybord }); $('.av-search-close').click(function () { $('.top-mobile-search-hide').fadeOut("slow"); $('.open-mobile-search').css('color','#fff'); }); $('.navbar-toggle').click(function () { $('.top-mobile-search-hide').hide(); $('.open-mobile-search').css('color','#fff'); }); }); // Back to TOP if ($('#back-to-top').length) { var scrollTrigger = 100, // px backToTop = function () { var scrollTop = $(window).scrollTop(); if (scrollTop > scrollTrigger) { $('#back-to-top').addClass('show'); } else { $('#back-to-top').removeClass('show'); } }; backToTop(); $(window).on('scroll', function () { backToTop(); }); $('#back-to-top').on('click', function (e) { e.preventDefault(); $('html,body').animate({ scrollTop: 0 }, 700); }); } // Parallax Scrolling Backgrounds $(window).bind('load', function() { parallaxInit(); }); function parallaxInit() { $('.parallax').parallax("10%", 0.1); } // Scroll Reveal on search results pages var $container = $('[data-avenue-part="search-results"]'); var sr = ScrollReveal({ duration: 1000 }); sr.reveal('.av-result', 100, {container: $container[0]}); $container.on('avenue.reload.complete', function() { sr.sync(); }); // Should be fine to not have this in avenue JS since it is very specifically for this template. // Maybe we should not use the 'data-avenue' namespace here $('[data-avenue-toggle-search]').on('click', function(e) { var $this = $(this), $searchBox = $this.closest('.av-icon-nav'); $searchBox.toggleClass('show-search'); if ($searchBox.hasClass('show-search')) { $searchBox.find('input').focus(); } }); });