Load sidebar template just once to prevent multiple animations

you can write the script with a conditions

<?php is_front_page(){ ?>
<script>
jQuery(window).ready(function($){
    $("#sidebarRight").animate({right: '0px'});
});
</script>
<?php } ?>

alternatively you can set the cookie or localstorage that the animation has been completed

<script>
    if(!localStorage.getItem("animated")){ // check if the animated is set if not set do the animation
       jQuery(window).ready(function($){
        jQuery("#sidebarRight").animate({right: '0px'});
        localStorage.setItem("animated", "yes"); // after comleting the animation set the animated so that animation does not happen again
    });
}
    </script>