Skip to content

Instantly share code, notes, and snippets.

@Solomko2
Created July 14, 2015 15:46
Show Gist options
  • Save Solomko2/d385a27a062ee8ba65be to your computer and use it in GitHub Desktop.
Save Solomko2/d385a27a062ee8ba65be to your computer and use it in GitHub Desktop.
fixed-header
Getting Started
Include jQuery
Include jquery.headtacular.js
When the document is ready(), call .headtacular() on the element which you'd like to stick
Example
$('.header').headtactular({ scrollPoint: 100 });
.header {
transition: all 300ms;
background-color: #fff;
position: relative;
z-index: 9999;
}
.header.is-stuck {
position: fixed;
left: 0;
width: 100%;
top: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
scrollPoint (default: 0)
Sets the distance (in pixels) from the top of the browser window which the user must scroll to activate Headtacular.
showScrollPoint (default: false)
Sets the distance (in pixels) from the top of the browser window which the user must scroll to activate Headtacular.
parentOffset (default: true)
Activates the padding offset fix - the .parent() of the targeted object will have a padding-top applied equal to the height of the .is-stuck element.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment