How to scroll bottom to div jquery javascript
Solution 1- this is the simple script for scroll bottom to a div using jquery or javascript
With Javascript
var objDiv = document.getElementById("sinlgecontainerid");
objDiv.scrollTop = objDiv.scrollHeight;
With jQuery
var d = $('#div1');
d.scrollTop(d.prop("scrollHeight"));
Or animated:$("#div1").animate({ scrollTop: $('#div1').prop("scrollHeight")}, 1000);
Solution 2 -
You
could set an interval to update the element's scrollTop to its
scrollHeight every couple of seconds
window.setInterval(function() {
var elem = document.getElementById('data');
elem.scrollTop = elem.scrollHeight;
}, 5000);
Comments
Post a Comment