1

I'm using Tiny Scroll Bar from here http://baijs.nl/tinyscrollbar/.

My problem is that when I toggle the folder (i.e: http://prntscr.com/tqf3j), the scroll bar is jumping to the top. I want to stay at a fixed position.

Part of my JavaScript code:

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

  }

I don't know the position of folders because every user can add a folder.

Default
  • 16,020
  • 3
  • 24
  • 38
Mirko Mukaetov
  • 204
  • 3
  • 14
  • I'm not sure this is the best solution but you could rewrite your function to use onClick attribute and do something like this: http://stackoverflow.com/questions/4825295/javascript-onclick-to-get-the-id-of-the-clicked-button Then you can get the position of the element that was clicked using .position() (http://api.jquery.com/position/) if you are using jQuery. – Evan Layman Feb 22 '13 at 18:26

1 Answers1

2

Try this:

oScrollbar5.tinyscrollbar_update('relative');
Petre
  • 108
  • 1
  • 9
  • Maybe you should explain little more why this should work, not just post code. – partlov Feb 28 '13 at 13:12
  • I've used it on my site and it works like a charm what is more check the bottom of the [TINYSLIDER SITE](http://baijs.nl/tinyscrollbar/) : it is said : tinyscrollbar_update('relative') - sets the position of the scrollbar relative to the old content when new content is passed in. – Petre Feb 28 '13 at 17:36