0

I'm working on a tab menu, so I have 2 contents that displays a table with scrollbar. my problem is when I switch to the other content the scroll from the other content retains.

hope you help me thanks.

SAMPLE CODE

$('tbody').niceScroll({autohidemode: false});
$('.table:first-child').show();
$('.side ul li').click(function(){
  $(this).addClass('active').siblings().removeClass('active');
  var index = $(this).index() + 1;

  $('.container .table:nth-child('+ index +')').show().siblings().hide();
});

1 Answers1

1

Triggering a resize on the nicescroll object seems to work:

$('tbody').niceScroll({autohidemode: false});
$('.table:first-child').show();
$('.side ul li').click(function(){
  $(this).addClass('active').siblings().removeClass('active');
  var index = $(this).index() + 1;

  $('.container .table:nth-child('+ index +')').show().siblings().hide();

  $('tbody').getNiceScroll().resize();
});

Example.

Jacques Marais
  • 2,666
  • 14
  • 33