Прокрутите до верхней кнопки с липким свойством, чтобы остановить над кредитами div / container - PullRequest
0 голосов
/ 14 июля 2020

В настоящее время я работаю над кнопкой прокрутки вверх. Я бы хотел, чтобы он оставался выше кредитов div / cook ie div.

В текущем коде jQuery у меня есть плохое временное решение для уведомления Cook ie. Думаю, я могу облегчить задачу, используя липкий. Но каждый раз, когда я пытаюсь, это работает не так, как предполагалось. Что я могу попробовать дальше?

CSS

#scroll-top{
    display: none;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    outline: none;
    background: -webkit-linear-gradient(45deg, #ff91a2 0%,#ffabb7 100%);
    background: <?= $headerBackgroundColor; ?>;
    color: #fff;
    cursor: pointer;
    border-radius: 100%;
    font-size: 18px;
    box-shadow: 0px 6px 10px -5px rgba(0, 0, 0, 0.2);
    width: 50px;
    height: 50px;
    overflow: hidden;
}

#scroll-top::after{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.0);
    border-radius: 100%;
    z-index: -1;
    transform: scale(0);
    transform-origin: center;
    transition: transform 0.25s, border-radius 0.25s, background 0.25s;
}

#scroll-top:hover::after{
    transform: scale(1);
    border-radius: 100%;
    transform-origin: center;
    background: rgba(255,255,255,0.15);
}

#scroll-top svg{
    transform: translateY(0%);
    opacity: 1;
    animation: fade-up 0.4s ease-out;
    animation-delay: 0.2s;
    animation-fill-mode: backwards;
}

@keyframes fade-up{
    0%{transform: translateY(80%); opacity:0 ;}
    80%{opacity:1 ;}
    100%{transform: translateY(0%); opacity:1 ;}
}

ТЕКУЩИЙ JQUERY

$(document).ready(function(){

    //Check to see if the window is top if not then display button
    $(window).scroll(function(){
        if ($(this).scrollTop() > $(window).height()) {
            $('#scroll-top').fadeIn(300);
            $('#scroll-top').css('display', 'flex');
        } else {
            $('#scroll-top').fadeOut(300);
        }
    });

    //Click event to scroll to top
    $('#scroll-top').click(function(){
        $('html, body').animate({scrollTop : 0},800);
        return false;
    });

    //If Cookie-container is visable add bottom value
    if ($("#cookie-notification-container").is(':visible')){
    $("#scroll-top").css('bottom', 80 + 'px');
    } else {
        $("#scroll-top").css('bottom', '20px');}

});

HTML

<!-- ► SCROLL TOP -->

<button id="scroll-top" onclick="topFunction()">
    <?php include 'media/svg/icons/arrow-up.php';?>
</button>

<!-- ► FOOTER -->

<footer id="footer">

<div class="wrapper">


</div>

</footer>

<!-- ► CREDITS -->

<?php include 'web-components/credits/credits.php'; ?>

</body>
...