// Literally speaking, this below line is needed to work jQuery window.addEventListener('load', function() { var allIds = "#cheap_cars, #popular_cars, #cars_by_year, #popular_cities"; var locale = "en" var currentLocation = window.location.pathname if(currentLocation === "/es") { currentLocation = "/es/" } if(locale === "en") { $("#handleChangeLanguage, #assign-lang").attr("href","/es"+currentLocation); } else if (locale === "es"){ var withOutEs = currentLocation.replace("/es",""); // After removing "es", if the pathname is empty, then we should give the full path from href var nextLocation = withOutEs === "" ? window.location.href.replace("/es","") : withOutEs; $("#handleChangeLanguage, #assign-lang").attr("href",nextLocation); } // this mouseup handles the click outside the nav tab $(document).mouseup(function(event) { var container = $(allIds + ", #hamburger_btn"); // if the target of the click isn't the container nor a descendant of the container if (!container.is(event.target) && container.has(event.target).length === 0) { // On Mobile device, if the user clicks outside the nav, // and if that nav is open, then we will close the nav $("#hamburger_btn").removeClass("close"); $("#main_navigation, .nav-stage").removeClass("active"); // On any device, the active class of the navs should be closed $(allIds).removeClass("active"); } }); $(allIds).click(function() { var itHasClass = $(this).hasClass("active"); $(allIds).removeClass("active"); if (!itHasClass) { $(this).toggleClass("active"); } }); $("#hamburger_btn").click(function() { $("#hamburger_btn").toggleClass("close"); $("#main_navigation, .nav-stage").toggleClass("active"); }); $("#back-to-result").click(function() { if($(this).data('backLink') === 'back') { window.history.back(); } else { window.location.assign($(this).data('backLink')); } }) });

Ad Choices

Third parties who place advertisements on this website and other service providers may collect and use information about your visits to this website and other websites in order to provide advertisements about goods and services of interest to you. If you would like to obtain more information about the practices of some of these parties, or if you would like to make choices about their use of your information, please click here:


More information and additional consumer choice options may be found here:


Auto.com adheres to the Self-Regulatory Principles for Online Behavioral Advertising.

For more information please visit: http://www.aboutads.info.

Last Updated — Tue Jun 21 10:34:32 GMT-06:00 2016