troubleshooting Question

Scroll always down

Avatar of Ahmad Jaber
Ahmad JaberFlag for Côte d'Ivoire asked on
JavaScript
1 Comment1 Solution15 ViewsLast Modified:
Good morning all ! I hope you are well ?

The code below allows me to update a page (content.php) every X seconds. Only the scroll tires me and I can't manage it ...
In fact, I want it to follow the choice of the user without updating at any time.
I know I put it behind a page load but if you have another solution, I'm addicted.

<div id="mini_panier></div>

<script>
function load() {
$.ajax({
url: "<?php echo $CONTENTS; ?>/mini-cart/content.php",
cache: false,
success: function(html){
$("#mini_panier").html(html);

    var oldscrollHeight = $("#mini_panier").prop("scrollHeight") - 20;
    var newscrollHeight = $("#mini_panier").prop("scrollHeight") - 20;
    if(newscrollHeight > oldscrollHeight){$("#mini_panier").animate({ scrollTop: newscrollHeight }, 'normal');}

},});
}
setInterval(load, 1500);
</script>

Thank you in advance for your help.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros