When I scrolled down site display black menu bar at the top look like float bar. but I think there's jquery involved with this. I have tried CSS but seems not working for me like the way i want it to
#menucontainer { position:fixed; top:0; height: 250px } #firstElement { margin-top: 250px }
Here is the website basic idea of what I would like the menu to be like:
http://avathemes.com/WP/Hexic/
A floating navigation menu, sometimes called a sticky navigation menu, is a menu that stays visible on the page even as you scroll down. No matter where a visitor is on the page, they'll see your menu options either along the top or side of the page.
Wrap your menu in an div or section with an ID or class.
#yourID.fixed { position: fixed; top: 0; left: 0; z-index: 1; width: 100%; border-bottom: 5px solid #ffffff; } //STICKY NAV $(document).ready(function () { var top = $('#yourID').offset().top - parseFloat($('#yourID').css('marginTop').replace(/auto/, 100)); $(window).scroll(function (event) { // what the y position of the scroll is var y = $(this).scrollTop(); // whether that's below the form if (y >= top) { // if so, ad the fixed class $('#yourID').addClass('fixed'); } else { // otherwise remove it $('#yourID').removeClass('fixed'); } }); });
Can't remember where I got this from, so no salutations to me, but it worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With