var vlp = vlp || {}; /** @author Matt Przybylski **/ vlp.cherokee = (function($, document, window, undefined) { 'use strict'; /* ----------------------------------------------------------------------------- *\ Public Methods \* ----------------------------------------------------------------------------- */ /** @method init @return {null} **/ function init() { vlp.init(); // init side navigation var heroHeight = $('#hero-module').height() + 200; // init side navigation $.sideNavigation({ topOffset: heroHeight }); // script for default price for sport var getModelContainer = $(".model-items"); getModelContainer.on("click", "li", function() { var getClickedModel = $(this).find("a:first").attr("data-model"); if (getClickedModel == "sport") { $(this).find("span[data-drive='4x2']").show(); $(this).find("span[data-drive='4x4']").hide(); } }); } // fix to hide tooltip coming in award section $("#awards,#offers-slideshow").mouseenter(function() { $(this).data('hover', 1); }).mouseleave(function() { $(this).data('hover', 0) }); /* fixing CGMAIN-10781 */ $('#footer-links li a').on('click', function() { var lid = $(this).data('lid'); if (lid && (lid == "grand_cherokee_limited_75th_anniversary_edition" || lid == "grand_cherokee_75th_anniversary_edition")) { window.location.href = $(this).attr('href'); location.reload(true); } }); /* fixing end CGMAIN-10781 */ //Turn on or off the headlamp on hover $('.anim').mouseenter(function() { $(this).find('.normal').fadeOut(); $(this).find('.swap').fadeIn(); }); $('.anim').mouseleave(function() { $(this).find('.swap').fadeOut(); $(this).find('.normal').fadeIn(); }); //Temp function for Overland CTA to scroll to Overland Section instead of BMO //$('#overland_hero_cta').on('click', handleNavClick); //$('.mod-modelizer .vehicle div:last-child .gc-button-large').on('click', handleNavClick); function handleNavClick(evt) { evt.preventDefault(); clearTimeout(this.rescrollTimeout); $('#gallery').delay(500).scrollTo({ speed: 'slow', topOffset: 0, //added 10px to make heading a little below afterScroll: function() { //var top = settings.nav.offset().top - navY + 1; // after the scroll has happened, "re-scroll" to it again after a short delay just to make // sure that the content has lazy loaded and the scroll actually got to that section properly this.rescrollTimeout = setTimeout(function() { $('#gallery').scrollTo({ speed: 'slow', topOffset: 65 }); //added 10px to make heading a little below }, 500); } }); } //End Overland Temp // Expose API publicly return { init: init }; })(jQuery, document, window); // Initialize this VLP jQuery(function() { 'use strict'; vlp.cherokee.init(); }); $(window).load(function() { $('.mod-gallery-slider.enhanced .pagination>a').attr('data-lpos', 'enhanced-gallery'); $("html, body").animate({ scrollTop: 0 }, "slow"); /* Lpos values for enhanced gallery was required to be 'enhanced gallery' As the plugins are set on a global level, implementing this chane would've required changes in other files and markup as well. Hence using this implementation for now. */ });