开发者

Jquery ScrollPane

As anybody ever have add issue with still being able to scroll outsi开发者_如何学编程de the boundaries of the div you are scrolling.

For legal reasons am unable to post the code sadly.


If i assume correctly, you are using jScrollPane and the scroll container expands beyond the window dimensions on window resize. There is a bug in the code where the width and height is calculated for the content and container. Basically, you need to reassign the width and height on window resize. Here is a working example:

var oldWindowHeight = $(window).height();
var oldWindowWidth = $(window).width();
$(function () {
    $('.tdMiddleRightContent').each(function () {
        $(this).jScrollPane({
            showArrows: true,
            hideFocus: true
        });
        var api = $(this).data('jsp');
        var throttleTimeout;
        $(window).bind('resize', function () {
            var newWindowHeight = $(window).height();
            if ((newWindowHeight - oldWindowHeight) < 0) {
                $(".jspContainer").height($(".jspContainer").height() + (newWindowHeight - oldWindowHeight));
            }
            var newWindowWidth = $(window).width();
            if ((newWindowWidth - oldWindowWidth) < 0) {
                $(".jspContainer").width($(".jspContainer").width() + (newWindowWidth - oldWindowWidth));
            }
            if ($.browser.msie) {
                if (!throttleTimeout) {
                    throttleTimeout = setTimeout(function () {
                        api.reinitialise();
                        throttleTimeout = null;
                    }, 50);
                }
            } else {
                api.reinitialise();
            }
            oldWindowHeight = $(window).height();
            oldWindowWidth = $(window).width();
        });
    });
});


It actually turned out to be the fact i was using jquery 1.2.6, I had to upgrade to jquery 1.3.2 to solved my issue.

Thank you for your comments Ace Trajkov

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜