Put fixed menu in Blogspot

Asked

Viewed 77 times

0

I’m trying to put a fixed top on Blogspot, but without success. I don’t know exactly what happens, but javascript doesn’t work.

Link to the complete code: https://jsfiddle.net/6ovjnhor/

Now I’ll 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 that code the div "navi-arlina" add the other div when arriving at 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!

  • Vinicius, take a look at this code I found here, I’m kind of on the clock right now, it needs a touch-up to check the width. You must always help. jsfiddle

  • Oh friend I really want to thank you, I used my code, but I discovered the problem thanks to you. I had forgotten to put the Jquery library. AHSUHAUHS

  • Happens to me often buddy. Hahah A hug good luck

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.