S
S
Sergey Shurygin2015-10-14 17:22:31
User navigation
Sergey Shurygin, 2015-10-14 17:22:31

How to make such a menu in the mobile version of the site?

There is a question how the menu is made in the mobile version of the site www.rmchampagnesalon.com ?, namely:
3b669ada3e53426a8d153d37c1f3a498.png
It appears when scrolling from the bottom up.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ineshin, 2015-10-14
@IonDen

It can be done something like this: jsfiddle.net/IonDen/1orqh5tb

var $win = $(window),
    $menu = $('.menu'),
    oldY = 0,
    y = 0;

function scroll () {
    y = $win.scrollTop();
    
    if (y > oldY) {
        tglMenu(false);
    } else {
        tglMenu(true);
    }
    
    oldY = y;
}

function tglMenu (state) {
    $menu.toggleClass('active', state);            
}

$win.on('scroll', scroll);

<div class='test'></div>
<div class='menu'>Menu</div>

.test {
    width: 100px;
    height: 3000px;
}

.menu {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    height: 70px;
    background: #f00;
    display: none;
}
.menu.active {
    display: block;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question