andrew
andrew

Reputation: 11

Why the update method in the tiny Scrollbar jQuery plugin is not working in this script?

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.

Upvotes: 1

Views: 9760

Answers (3)

mohsen13th
mohsen13th

Reputation: 1

var $scrollbar= $('#list-scrollbar');
$scrollbar.tinyscrollbar();
var scrolbar1=$scrollbar.data("plugin_tinyscrollbar");
scrollbar1.update();

Upvotes: -1

elkelk
elkelk

Reputation: 1752

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/

Upvotes: 3

andrew
andrew

Reputation: 11

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

Upvotes: -1

Related Questions