JScrollPane scroll size

I am using jScrollPane and trying to figure out how to get a scrollable amount. Basically I want to know when the user reaches the bottom of the scroll so that I can run another function. This is my function:

in_page_scroll : function() {
    "use strict";
    var inpage_container = $('.pal_inpage_wrapper'),
        inpage_top_padd = $('.header_wrapper').height(),
        win_main_height = $(window).height() - inpage_top_padd;
        inpage_container.css({
            height: win_main_height,
            marginTop: inpage_top_padd,
            paddingTop: 0}).jScrollPane({
                autoReinitialise: true,
                enableKeyboardNavigation : true
            }).bind('mousewheel', function(e) {
                e.preventDefault();
            });
}

Thanks in advance.

- * EDIT * ------------------------------------------ ---- -------------------------------------

I just found out the answer. There he is:

$(function() {
    var element = $('.scroll-pane').jScrollPane(),
        api = element.data('jsp');

    $('.scroll-pane').bind('scroll', function() {
        if($('.scroll-pane').outerHeight() + api.getContentPositionY() >= api.getContentHeight()) {
            //Fire another function here
        }
    });             
});
+3
source share
1 answer

Just to give a recommendation and a stylish finish, I use this:

 Js

    $ ('# jScrollPane'). bind (
        'jsp-scroll-y',
        function (event, scrollPositionY, isAtTop, isAtBottom)
        {   
            if (scrollPositionY> 0) { 
                $(this).addClass('ShadowTOP')
            }
            if(isAtTop) { 
                $(this).removeClass('ShadowTOP')
            }
        }
    ).jScrollPane()

. GMail.

STYLE

    .TransitionShadow{
        transition: all 0.35s ease-in-out;
        -webkit-transition: all 0.35s ease-in-out;
        -moz-transition: all 0.35s ease-in-out; 
    }
    .ShadowTOP{
       -webkit-box-shadow: inset 0px 12px 16px -10px rgba(100, 100, 100, 0.3);
        box-shadow: inset 0px 10px 16px -10px rgba(100, 100, 100, 0.3);
    }

+2

All Articles