document.addEventListener("DOMContentLoaded", function(event) {
var myElement = document.querySelector("#g-header");
//console.log(myElement); // is this null?
var headroom = new Headroom(myElement, {
"offset": 0,
"tolerance": 0,
"classes": {
// when element is initialised
initial : "headroom",
// when scrolling up
pinned : "headroom--pinned",
// when scrolling down
unpinned : "headroom--unpinned",
// when above offset
top : "headroom--top",
// when below offset
notTop : "headroom--not-top"
},
// callback when pinned, `this` is headroom object
onPin : function() {},
// callback when unpinned, `this` is headroom object
onUnpin : function() {},
// callback when above offset, `this` is headroom object
onTop : function() {},
// callback when below offset, `this` is headroom object
onNotTop : function() {}
});
var myElement2 = document.querySelector("#g-navigation");
//console.log(myElement2); // is this null?
var headroom2 = new Headroom(myElement2, {
"offset": 0,
"tolerance": 0,
"classes": {
// when element is initialised
initial : "headroom2",
// when scrolling up
pinned : "headroom--pinned2",
// when scrolling down
unpinned : "headroom--unpinned2",
// when above offset
top : "headroom--top2",
// when below offset
notTop : "headroom--not-top2"
},
// callback when pinned, `this` is headroom object
onPin : function() {},
// callback when unpinned, `this` is headroom object
onUnpin : function() {},
// callback when above offset, `this` is headroom object
onTop : function() {},
// callback when below offset, `this` is headroom object
onNotTop : function() {}
});
headroom.init();
headroom2.init();
});
.headroom--not-top.headroom--pinned ~ section#g-navigation {
left: 0px;
position: fixed;
right: 0px;
top: 0px;
z-index: 100;
max-height: 100px;
margin-top:99px;
-webkit-transition: all 0.5s ease-out;
}
.headroom--not-top.headroom--pinned {
left: 0px;
position: fixed;
right: 0px;
top: 0px;
z-index: 100;
max-height: 100px;
transform: translateY(0%);
}
.headroom--not-top.headroom--unpinned {
transform: translateY(-100%);
}
#g-header {
transition: transform .35s ease-out;
}
html:not(.g-offcanvas-open) .g-offcanvas-toggle {
position: fixed;
}
html.g-offcanvas-open .g-offcanvas-toggle {
position: fixed;
left: 275px;
}
The following users have thanked you: Irresisti
#g-header {
background-image: url("http://www.seleatherfest.com/dev4/images/sitegraphics/metalbackground200.jpg");
background-repeat: no-repeat;
background-size: cover;
}
#g-header #g-content {
margin: 0;
max-height: 275px;
padding: 0;
}
header#g-header {
left: 0;
position: fixed;
right: 0;
top: 0;
z-index: 100;
}
section#g-navigation {
left: 0;
position: fixed;
right: 0;
top: 275px;
z-index: 100;
}
#g-page-surround > section#g-navigation + * {
padding-top: 385px;
}
.g-offcanvas-toggle {
z-index: 110;
}
html.g-offcanvas-open header#g-header, html.g-offcanvas-open section#g-navigation {
left: 272px;
}
html:not(.g-offcanvas-open) header#g-header, html:not(.g-offcanvas-open) section#g-navigation {
left: 0;
}
html.g-offcanvas-opening header#g-header, html.g-offcanvas-opening section#g-navigation {
left: 272px;
transition: left 300ms ease 0s, right 300ms ease 0s;
}
html.g-offcanvas-closing header#g-header, html.g-offcanvas-closing section#g-navigation {
left: 0;
transition: left 300ms ease 0s, right 300ms ease 0s;
}
The following users have thanked you: MrT
Time to create page: 0.051 seconds