0

カスタムスクロールバーを一部のコンテンツに追加するためにjscrollpaneを試しています。データは ajax 経由で取り込まれており、jscrollpane APIはそのためにうまく機能します。

しかし、スクロールペインの高さを常に、たとえばユーザーのブラウザー ウィンドウの高さの 70% にしようとしています。jscrollpaneサイトには、次のコードを使用して機能させることができると書かれていますが、うまくいきません。

$(function () {
    $('.scroll-pane').each(

    function () {
        $(this).jScrollPane({
            showArrows: $(this).is('.arrow')
        });
        var api = $(this).data('jsp');
        var throttleTimeout;
        $(window).bind('resize', function () {
            if ($.browser.msie) {
                // IE fires multiple resize events while you are dragging the browser window which
                // causes it to crash if you try to update the scrollpane on every one. So we need
                // to throttle it to fire a maximum of once every 50 milliseconds...
                if (!throttleTimeout) {
                    throttleTimeout = setTimeout(

                    function () {
                        api.reinitialise();
                        throttleTimeout = null;
                    }, 50);
                }
            } else {
                api.reinitialise();
            }
        });
    })

});

CSS をパーセンテージに変更すると、カスタム スクロールバーが完全に失敗し、ウィンドウの高さの 100% である既定のクロム スクロールバーが表示されます。

http://jsfiddle.net/loren_hibbard/2yEsG/

どうもありがとうございました!

4

1 に答える 1

-1

resize と jsfiddle の API に互換性の問題があるようです。jscrollpane は引き続き素晴らしい拡張機能です。ありがとう。

于 2012-08-09T19:33:41.513 に答える