切换上的微小滚动正在跳到顶部

Tiny scroll on toggle is jumping to top

本文关键字:顶部 滚动      更新时间:2023-09-26

我在这里使用小滚动条http://baijs.nl/tinyscrollbar/.

我的问题是,当我切换文件夹(即:http://prntscr.com/tqf3j),滚动条正在跳到顶部。我想呆在一个固定的位置上。

我的JavaScript代码的一部分:

$(document).on('click', '#TreeView a', function() {
  CloseFolderOptions();
  $('#TreeView a').removeClass('selected');
  $(this).addClass('selected');
  if ($(this).next('.sub').find('li').length > 0) {
      $(this).next('.sub').slideToggle();
      oScrollbar5.tinyscrollbar_update();
  }

我不知道文件夹的位置,因为每个用户都可以添加一个文件夹。

试试这个:

oScrollbar5.tinyscrollbar_update('relative');