gwt.material.design.addins.client.waterfall.resources.js.waterfall.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-material-addins Show documentation
Show all versions of gwt-material-addins Show documentation
Extra Components of GWT Material Framework
function initWaterfall(height, showCallback, hideCallback, offset) {
$('nav').pushpin({ top: height });
$('nav').addClass('z-depth-0');
var callbacks = $.Callbacks();
var show;
function stickyScroll(e) {
if( window.pageYOffset > offset) {
if (show !== true) {
$('nav').removeClass('z-depth-0');
$('nav').addClass('z-depth-1');
show = true;
}
}else{
if (show === true) {
$('nav').removeClass('z-depth-1');
$('nav').addClass('z-depth-0');
show = false;
}
}
if( window.pageYOffset > 1) {
callbacks.add(hideCallback);
callbacks.fire();
}else{
callbacks.add(showCallback);
callbacks.fire();
}
}
window.addEventListener('scroll', stickyScroll, false);
}