Answers for "how to detect div scroll and also detect scrolled at bottom in jquery and bootstrap"

0

how to detect div scroll and also detect scrolled at bottom in jquery and bootstrap

// html (bootstrap used for quick design)


<div class="row mx-auto">
  <div class="col-4 border overflow-auto scrolling" id="one" style="height: 300px;">
    <div class="min-vh-100 bg-danger scroll-body" data-fetch="{url}" >
     <!- your data here -->
    </div>
  </div>  
</div>


// jquery code

$(document).ready(function(){  
	$(".scrolling, window").scroll(function(){    
    	  var position = $(this).scrollTop();    
        var bottom = $(this).children(".scroll-body").height() - $(this).height();  
        if (position == bottom)
        {
          	// do something
         	console.log(
            	'position : ' + $(this).scrollTop() + '<br>' +
            	'bottom : ' + ( $(this).children(".scroll-body").height() - $(this).height() )
            );	
        }
	});  
});
Posted by: Guest on May-02-2021

Code answers related to "how to detect div scroll and also detect scrolled at bottom in jquery and bootstrap"

Code answers related to "Javascript"

Browse Popular Code Answers by Language