Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(".vehicle-data").hide();
- var activeVehicleData = $(".vehicle-nav .active a").attr("href");
- $(activeVehicleData).show();
- $('.vehicle-nav-scroll').click(function () {
- var topPos = 0;
- 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);
- // Scroll Down
- if ((direction == 'down') && (actTopPos > x) && (-navHeight <= (actTopPos - (scrollHeight * 2)))) {
- topPos = actTopPos - scrollHeight;
- $(".vehicle-nav").css('top', topPos);
- //alert(topPos+' '+ navChildHeight+' '+ x);
- }
- // Scroll Up
- if (direction == 'up' && 0 > actTopPos) {
- topPos = actTopPos + scrollHeight;
- $(".vehicle-nav").css('top', topPos);
- }
- return false;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement