首页 > 解决方案 > 滚动条显示在其他内容上

问题描述

我正在处理选项卡菜单,所以我有 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();
});

标签: javascriptjquerynicescroll

解决方案


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

例子。


推荐阅读