newsanti Posted August 24, 2023 Share Posted August 24, 2023 How to ajaxRequest of TuniFrame on end vertical scroll ? VerticalScrollEnd.zip Quote Link to comment Share on other sites More sharing options...
newsanti Posted August 24, 2023 Author Share Posted August 24, 2023 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 } }) } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 24, 2023 Share Posted August 24, 2023 Hello, Do you have a simple testcase? Quote Link to comment Share on other sites More sharing options...
newsanti Posted August 24, 2023 Author Share Posted August 24, 2023 17 minutes ago, Sherzod said: Hello, Do you have a simple testcase? VerticalScrollEnd.zip Quote Link to comment Share on other sites More sharing options...
newsanti Posted August 24, 2023 Author Share Posted August 24, 2023 17 minutes ago, newsanti said: VerticalScrollEnd.zip 122.58 kB · 2 downloads 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! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 24, 2023 Share Posted August 24, 2023 4 minutes ago, newsanti said: work! Ok. Quote Link to comment Share on other sites More sharing options...
newsanti Posted August 24, 2023 Author Share Posted August 24, 2023 1 hour ago, Sherzod said: Ok. Do you have other choice to check end scroll? some time H3=1 instand H3=0 Quote Link to comment Share on other sites More sharing options...
newsanti Posted August 24, 2023 Author Share Posted August 24, 2023 5 hours ago, Sherzod said: Ok. My method generate many events. don't work. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted August 24, 2023 Share Posted August 24, 2023 4 hours ago, newsanti said: My method generate many events. don't work. I thought you already solved the issue. If the question is about optimality, then we will try to analyze. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.