<?php
include_once "include/constantes.php";
?>

<a href="#top" id="scroll-up" class="btn btn-primary btn-sm" role="button" aria-pressed="true" style="display: none; position: fixed; bottom: 3rem; right: 1rem;">
    <?= $ICO['arriba'] ?>
</a>
<!-- Scroll down -->
<a href="#bottom" id="scroll-down" class="btn btn-primary btn-sm" role="button" aria-pressed="true" style="display: none; position: fixed; bottom: 1rem; right: 1rem;">
    <?= $ICO['abajo'] ?>
</a>

<script>
    $(document).ready(function() {
        $(window).scroll(function() {
            if ($(this).scrollTop() > 100) {
                $('#scroll-up').fadeIn();
            } else {
                $('#scroll-up').fadeOut();
            }

            if ($(this).scrollTop() < $(document).height() - $(window).height() - 100) {
                $('#scroll-down').fadeIn();
            } else {
                $('#scroll-down').fadeOut();
            }
        });
        $('#scroll-up').click(function() {
            $("html, body").animate({
                scrollTop: 0
            }, 600);
            return false;
        });

        $('#scroll-down').click(function() {
            $("html, body").animate({
                scrollTop: $(document).height()
            }, 600);
            return false;
        });
    });
</script>