Skip to content

Instantly share code, notes, and snippets.

@kisildev
Last active March 1, 2019 11:17
Show Gist options
  • Select an option

  • Save kisildev/dd8a9b215bdbe1aada5f351369d5819b to your computer and use it in GitHub Desktop.

Select an option

Save kisildev/dd8a9b215bdbe1aada5f351369d5819b to your computer and use it in GitHub Desktop.
Headhesive - Stiky menu
//CSS
.headhesive {
background-color: #FFF;
position: fixed;
width: 100%;
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
-ms-transform: translateY(-100%);
-o-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-ms-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
-webkit-box-shadow: 0px 2px 2px 0px rgba(222,222,222,1);
-moz-box-shadow: 0px 2px 2px 0px rgba(222,222,222,1);
box-shadow: 0px 2px 2px 0px rgba(222,222,222,1);
z-index: 100;
}
.headhesive--stick {
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0);
}
//JS
// Initialise with options
var top_main_menu = new Headhesive('.page_header', options);
// Set options
var options = {
offset: 500
};
// Headhesive destroy
if ($(window).width() <= '1024'){
top_main_menu.destroy();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment