社群

Sticky navigation makes it easy to affix menus to the top of the page whenever a user scrolls the page down. This could be very helpful and useful on long pages. Sticky is disabled on mobile devices to avoid unwanted content overlaps and to preserve valuable screen real estate.

Demo

Scroll down to fix the navigation.

<div data-component=“sticky”>…</div>

Settings

offset
  • Type: int
  • Default: 0

Sets top offset in pixels when navigation is fixed.

Callbacks

fixed

Using this callback, you can act upon menu becoming fixed at the top of the page.

$(’#my-nav’).on(‘fixed.sticky’, function()
{
    // do something…
});
unfixed

Whenever fixed position of the menu is released, you can do something with this callback.

$(’#my-nav’).on(‘unfixed.sticky’, function()
{
    // do something…
});