滚动条显示在其他内容上

时间:2018-06-29 10:24:35

标签: javascript jquery nicescroll

我正在使用选项卡菜单,所以我有2个内容显示带有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();
});

1 个答案:

答案 0 :(得分:1)

在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.

相关问题