// Custom JS for the Theme // Config //------------------------------------------------------------- var companyName = "Car Rental Station"; // Enter your event title // Initialize Tooltip //------------------------------------------------------------- $('.my-tooltip').tooltip(); // Initialize jQuery Placeholder //------------------------------------------------------------- $('input, textarea').placeholder(); // Toggle Header / Nav //------------------------------------------------------------- $(document).on("scroll",function(){ if($(document).scrollTop()>39){ $("header").removeClass("large").addClass("small"); } else{ $("header").removeClass("small").addClass("large"); } }); // Vehicles Tabs / Slider //------------------------------------------------------------- $(".vehicle-data").hide(); var activeVehicleData = $(".vehicle-nav .active a").attr("href"); $(activeVehicleData).show(); $('.vehicle-nav-scroll').click(function(){ var direction = $(this).data('direction'); var scrollHeight = $('.vehicle-nav li').height() + 1; var navHeight = $('#vehicle-nav-container').height() + 1; var actTopPos = $(".vehicle-nav").position().top; var navChildHeight = $('#vehicle-nav-container').find('.vehicle-nav').height(); var x = -(navChildHeight - navHeight); var fullHeight = 0; $('.vehicle-nav li').each(function() { fullHeight += scrollHeight; }); navHeight = fullHeight - navHeight + scrollHeight; // Scroll Down if ((direction == 'down') && (actTopPos > x) && (-navHeight <= (actTopPos - (scrollHeight * 2)))) { topPos = actTopPos - scrollHeight; $(".vehicle-nav").css('top', topPos); } // Scroll Up if (direction == 'up' && 0 > actTopPos) { topPos = actTopPos + scrollHeight; $(".vehicle-nav").css('top', topPos); } return false; }); $(".vehicle-nav li").on("click", function(){ $(".vehicle-nav .active").removeClass("active"); $(this).addClass('active'); $(activeVehicleData).fadeOut( "slow", function() { activeVehicleData = $(".vehicle-nav .active a").attr("href"); $(activeVehicleData).fadeIn("slow", function() {}); }); return false; }); // Vehicles Responsive Nav //------------------------------------------------------------- $("
").appendTo("#vehicle-nav-container").addClass("styled-select-vehicle-data"); $("