I'm trying to put a fixed top on Blogspot, but to no avail. I do not know exactly what happens, but javascript does not work.
Link to the full code: link
Now I'm going to show you the javascript I'm using:
<script>
$(function() {
var nav = $('#navi-arlina');
$(window).scroll(function() {
if ($(this).scrollTop() > 170) {
nav.addClass("menu-fixo");
} else {
nav.removeClass("menu-fixo");
}
});
});
</script>
In this code the div "navi-arlina"
add the other div when it reaches 178 px.
.menu-fixo {
position: fixed !important;
top: 0;
z-index: 99;
}
Follow the menu code:
<header>
<nav id='navi-arlina' itemscope='itemscope' itemtype='http://schema.org/SiteNavigationElement'>
<input type='checkbox' />
<label>MENU</label>
<ul>
<li><a href='link' itemprop='url'><span itemprop='name'>Notícias</span></a></li>
<li><a href='link' itemprop='url'><span itemprop='name'>Downloads</span></a>
<ul>
<li><a href='link' itemprop='url'><span itemprop='name'>Coleções Sims Center</span></a></li>
<li><a href='link' itemprop=''><span itemprop='name'>Para os Sims</span></a></li>
<li><a href='link' itemprop=''><span itemprop='name'>Objetos</span></a></li>
<li><a href='link' itemprop='url'><span itemprop='name'>Lotes</span></a></li>
</ul>
</li>
<li><a href='link' itemprop='url'><span itemprop='name'>The Sims 4</span></a>
<ul>
<li><a href='link' itemprop='link'><span itemprop='name'>Ajuda e Suporte</span></a></li>
<li><a href='link' itemprop='url'><span itemprop='name'>Downloads</span></a></li>
</ul>
</li>
<li><a href='link' itemprop='url'><span itemprop='name'>Coleções Sims Center</span></a></li>
<li><a href='#' itemprop='url'><span itemprop='name'>Nossos Portais</span></a>
<ul>
<li><a href='link' itemprop='url'><span itemprop='name'>Página Do Facebook</span></a></li>
<li><a href='link' itemprop=''><span itemprop='name'>Grupo Do Facebook 1</span></a></li>
<li><a href='link' itemprop=''><span itemprop='name'>Grupo Do Facebook 2</span></a></li>
<li><a href='link' itemprop='url'><span itemprop='name'>Canal do Youtube</span></a></li>
</ul>
</li>
<li><a href='link' itemprop='url'><span itemprop='name'>Séries Sims Center</span></a></li>
</ul>
</nav>
</header>
Please help me !!! I will be eternally grateful!