单击调用特殊的jQuery函数

时间:2013-03-13 13:14:20

标签: jquery function click tinyscrollbar

我正在使用tinyscrollbarscript。我想在我的页面上有一个按钮,可以在点击时模拟鼠标滚轮。我认为应该调用tinyscrollbar-script中的函数wheel(event)。我怎么能这样做?

$("#clickit").click(wheel);

但这不起作用

1 个答案:

答案 0 :(得分:1)

尝试

(文档)$。就绪(函数(){

 $("#clickit").click(function(){
   $('#your_tinyscrollbar_id').wheel();     //Your function call
});

});

[已更新]

你不能:这个函数实际上是私有的,只能在更新函数中访问。

以下是初始化tinyscrollbar

的说明
$('#your_scrollbar').data('tsb')             //Object description
    Scrollbar {update: function}
        update: function ( sScroll )
            arguments: null
            caller: null
            length: 1
            name: ""
            prototype: Object
            __proto__: function Empty() {}
            <function scope>                  //Private functions, accessible 
              Closure                         //only within the scope of the 
                drag: function drag( event )  //update function
                end: function end()
                iMouse: Object
                iPosition: Object
                iScroll: 0
                oContent: Object
                oScrollbar: Object
                oSelf: Scrollbar
                oThumb: Object
                oTrack: Object
                oViewport: Object
                oWrapper: p.fn.p.init[1]
                options: Object
                sAxis: false
                sDirection: "top"
                sSize: "Height"
                setEvents: function setEvents()
                setSize: function setSize()
                start: function start( event )
                touchEvents: false
                wheel: function wheel( event )
              Closure
            Global: Window
            __proto__: Scrollbar