1

I am using the tinyScrollbar Jquery plugin http://baijs.nl/tinyscrollbar/ on a div which is on page load has display:none so i have to use the update method when it is made visible (as the documentation says) but the update method is not working.. here is the code:

$("#list-scrollbar").tinyscrollbar();
$(".playlist-drop-btn").click(function(){
                $(".audio .drop").slideToggle(200);
                $(".playlist-drop-btn").toggleClass("up");
                $("#list-scrollbar").update();
            });

note: when I make the div on page load display:block it works correctly.

tshepang
  • 12,111
  • 21
  • 91
  • 136
andrew
  • 11
  • 1
  • 2
  • Don't forget to update your tinyscrollbar js to a recent version. `tinyscrollbar_update()` was not available prior to 2011. – Haluk Sep 27 '11 at 14:48
  • @Haluk and now tinyscrollbar_update is not available in the latest version. – NoBugs Feb 12 '17 at 08:40

3 Answers3

3

The function you need to call is tinyscrollbar_update()

$("#list-scrollbar").tinyscrollbar();
$(".playlist-drop-btn").click(function(){
            $(".audio .drop").slideToggle(200);
            $(".playlist-drop-btn").toggleClass("up");
            $("#list-scrollbar").tinyscrollbar_update();
        });

It is listed on the homepage at the very bottom: http://baijs.nl/tinyscrollbar/

elkelk
  • 1,692
  • 2
  • 13
  • 20
-1
var $scrollbar= $('#list-scrollbar');
$scrollbar.tinyscrollbar();
var scrolbar1=$scrollbar.data("plugin_tinyscrollbar");
scrollbar1.update();
Inspector Squirrel
  • 2,548
  • 2
  • 27
  • 38
  • can you explain what your solution does? What was the problem and how your solution solves it? This is for further reference from other users that will look for the same or similar issue – Lelio Faieta Dec 08 '15 at 10:05
-1

You should do this:

var oScrollbar = $("#list-scrollbar");
oScrollbar.tinyscrollbar();
$(".playlist-drop-btn").click(function(){
                $(".audio .drop").slideToggle(200);
                $(".playlist-drop-btn").toggleClass("up");
                oScrollbar.update();
            });
dandan78
  • 13,328
  • 13
  • 64
  • 78
andrew
  • 11
  • 1
    use oScrollbar.tinyscrollbar_update(); instead of oScrollbar.update(); – Chetan Jun 04 '12 at 07:44
  • 1
    Additionally, declaring oScrollBar outside of the anonymous function won't work. The context changes and access to oScrollbar is lost. – Will Reese Jan 23 '13 at 14:15