Saint Robson
Saint Robson

Reputation: 5525

Bootstrap scrollspy affect before section hit browser's top

I have bootstrap scrollspy perfectly works on my site, however I need some tweak because of this some issue :

my top menu (navbar) get hi-lighted when the section's div hit the browser top visible area. precisely.

but, since my top menu is floating, how to get this scrollspy effect works 50 pixel BEFORE that section's div hit the browser top visible area.

here's my jquery :

<script>
    $('body').scrollspy({ target: '#top-menu' });
</script>

thank you

Upvotes: 1

Views: 69

Answers (1)

Isai Landa
Isai Landa

Reputation: 13

Use the offset option

<script>
    $('body').scrollspy({ target: '#top-menu', offset: 50 });
</script>

Upvotes: 1

Related Questions