Problems with jquery scrollable API tools

I am using the jQuery Tools scrollable plugin and am trying to use its API to create custom controls. However, I cannot get them to work no matter what I do!

I have an auto scan, a vertical slide show and you want to pause it (or restart it or move it to a specific place) using my own custom elements. Using the code below, I get the error "Uncaught TypeError: Object #" when a pause error occurs when the pause button is pressed. What am I doing wrong?

$('document').ready(function() {
        $("#scrollable .items").cycle();
        $("#tabs").tabs("div.panes > div");         

        window.api = $("#sideScrollable").scrollable({
            vertical: true, 
            items: "ul", 
            size: 1,
            speed: 4000, 
            mousewheel: false, 
            keyboard: false, 
            circular: true}).navigator().autoscroll(0,{ 
                api: true,
                autoplay: true });

        $('.pause').click(function() {
            api.pause();            
            return false;
        });         

});

Many thanks for your help.

+3
source share
1 answer

, ( , ), , jQuery, . , : window.api, , :

var myAPI;
$('document').ready(function() {
    $("#scrollable .items").cycle();
    $("#tabs").tabs("div.panes > div");         

    myAPI = $("#sideScrollable").scrollable({
        vertical: true, 
        items: "ul", 
        size: 1,
        speed: 4000, 
        mousewheel: false, 
        keyboard: false, 
        circular: true
    }).navigator().autoscroll(0,{ 
        api: true,
        autoplay: true
    });

    $('.pause').click(function() {
        myAPI.pause();            
        return false;
    });         

});
+2

All Articles