Issue with full page horizontal scroll

2019-04-06 15:06发布

问题:

Is any other alternative for full page scroll?

example of full page scroll

http://jscrollpane.kelvinluck.com/fullpage_scroll.html

step-1 make window width smaller by clicking Restore down button.

step-2 scroll to right

step-3 now, make window width bigger by clicking Maximize button.

now, page is left aligned

jQuery

 $(function()
{
    var win = $(window);

    win.bind(
        'resize',
        function()
        {

                var container = $('#full-page-container');

                container.css(
                    {
                        'width': 1,
                        'height': 1
                    }
                );

                container.css(
                    {
                        'width': win.width(),
                        'height': win.height()
                    }
                );
                isResizing = false;
                container.jScrollPane(
                    {
                        'showArrows': true
                    }
                );

        }
    ).trigger('resize');


    $('body').css('overflow', 'hidden');


    if ($('#full-page-container').width() != win.width()) {
        win.trigger('resize');
    }


});

CSS

html
{
    overflow: auto;
}
#full-page-container
{
    overflow: auto;
}

回答1:

The thing here is that jScrollPane adds jspPane a left:-***px when you scroll to the right. And never undoes the damage.

If you would add:

$('#full-page-container .jspPane').css('left', 'auto');

In your resize, it will work. Although I suggest you report a bug for jScrollPane guys as well.