Jump to content
  • 0

navigation


mebelyan
 Share

Question

Здравствуйте. Помогите начинающему. Есть сайт - www.mebelyan.com. При скролле вниз выплывает навигация. Мне  нужно чтобы она была фиксированная сверху с прозрачным фоном, а при скролле бекграунд был синий. Как сделать?

Вот исходники

<div class="menubar" data-scroll="true">        <a href="#" class="logo"></a>                        <ul class="mainmenu">            <li class="active"><a href="#home">Главная</a></li>            <li><a href="#services">Преимущества</a></li>            <li><a href="#portfolio">Наши работы</a></li>            <li><a href="#contact">Контакты</a></li>        </ul>            </div>
.menubar {	position: fixed;	top: 0px;	height: 50px;	width: 100%;	z-index: 9999;	background-color: #FFF;	margin-top: -80px;	-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.2);	-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.2);	box-shadow: 0 2px 2px rgba(0,0,0,0.2);
// Menu Scroll Hide	var nav = $('.menubar');	var scroll = $('.menubar').attr('data-scroll');	$(function(){		$('.menubar').data('size','big');		if (scroll == 'false') {			nav.css({				marginTop:'0px'			});		};	});	$(window).scroll(function(){		if ($('body').scrollTop() > 0 && scroll == 'true') {			if (nav.data('size') == 'big') {				nav.data('size','small').stop().animate({					marginTop:'0px'				}, 300);			}		} else {			if (nav.data('size') == 'small' && scroll == 'true') {				nav.data('size','big').stop().animate({					marginTop:'-60px'				}, 300);			}					}	});
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy