Link to home
Start Free TrialLog in
Avatar of Jaber Ahmad
Jaber AhmadFlag for Côte d'Ivoire

asked on

Scroll always down

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>

Open in new window


Thank you in advance for your help.
ASKER CERTIFIED SOLUTION
Avatar of Jaber Ahmad
Jaber Ahmad
Flag of Côte d'Ivoire image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial