Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How can i give space between navbar and div

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #203683
    dauruk0512
    Participant

    Hei Again, i was frustration about navbar fixed with scroll div when click navbar, first i use js sminth here is http://www.outyear.co.uk/smint/ but i face problem

    make my navbar not responsive when small device not good looking

    so i decide to change plugin with this tutorial https://css-tricks.com/snippets/jquery/smooth-scrolling/

    and make navbar fixed when scroll i add up this script found in some forum

    `
    $(document).ready(function() {<br />
    var stickyNavTop = $(‘.nav’).offset().top;
    var stickyNav = function(){
    var scrollTop = $(window).scrollTop();

    if (scrollTop > stickyNavTop) {
    $(‘.nav’).addClass(‘sticky’);<br />
    } else {
    $(‘.nav’).removeClass(‘sticky’);<br />
    }
    };

    stickyNav();

    $(window).scroll(function() {
    stickyNav();
    });
    });
    `

    this is my demo http://pingsari.earworks.co.id/

    please kindly click one of href fasilitas, praktek, testimoni or kontak it give me not good looking,

    The point problem is first time click href always give div go away to the top (Sorry for bad explanation my english)

    how can i fixed that with add up space between navbar and div when scrolling, Thanks

    Freddy

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.