html - javascript get scroll of child div -


i have structure this:

<div>      <div id="scrollid" style="height:100px;">          content here     </div>  </div>  <script> document.getelementbyid("mydiv").addeventlistener("touchstart", myfunction); function myfunction() {     // want position } </script> 

i want distance top, when user start scrolling (actually touching in mobile). final purose implementing pull refresh child div.

any idea?

try following.

<div>      <div id="scrollid" style="height:100px;" onscroll="myfunction();">          content here     </div>  </div>  <script> document.getelementbyid("mydiv").addeventlistener("touchstart", myfunction); function myfunction() {     document.getelementbyid("scrollid").scrolltop;     // want position } </script> 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -