显示在其他内容上的滚动条

scroll bar showing on other content

我正在处理选项卡菜单,所以我有 2 个显示 table 和 scrollbar 的内容。我的问题是当我切换到其他内容时,其他内容的滚动条会保留。

希望你能帮助我谢谢。

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();
});

在 nicescroll 对象上触发 resize 似乎有效:

$('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.