Jump to content

How to ajaxRequest of TuniFrame on end vertical scroll ?


newsanti

Recommended Posts

function afterrender(sender, eOpts)
{
    var me = sender;
    me.el.dom.addEventListener('scroll', function(event) {
    var element = event.target;
    if (element.scrollTop === 0) {
      ajaxRequest(me, 'scrolledToTop', []);
    } else
    if (element.scrollHeight-element.scrollTop===element.clientHeight) {
      ajaxRequest(me, 'scrolledToBottom', []); <== don't fire event
    }

    })
}

Link to comment
Share on other sites

17 minutes ago, newsanti said:

function afterrender(sender, eOpts)
{
    var me = sender;
    me.el.dom.addEventListener('scroll', function(event) {
    var element = event.target;
    if (element.scrollTop === 0) {
      ajaxRequest(me, 'scrolledToTop', []);
    } else
      {
        var H1 = Math.round(element.scrollHeight-element.scrollTop);
        var H2 = Math.round(element.clientHeight);
        var H3 = H1-H2;
        if (H3===0) {
           ajaxRequest(me, 'scrolledToBottom', 
                       {'scrollTop': element.scrollTop, 
                        'scrollHeight': element.scrollHeight,
                        'clientHeight': element.clientHeight,
                        'H1': H1,
                        'H2': H2,
                        'H-T': H1-H2
                        });
        }
      }
    })
}

work!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...