0

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

希望你能帮助我谢谢。

示例代码

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

1 回答 1

1

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

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

例子。

于 2018-06-29T10:42:54.783 回答