gwt.material.design.addins.client.subheader.resources.js.subheader.min.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 initSubheader(e,t){jQuery(document).ready(function(){var o=new stickyTitles(e,t);o.load(),$(t).on("scroll",function(){o.scroll()})})}function stickyTitles(e,t){var o=jQuery(e),s=jQuery(t);s.addClass("subheader-container");var r=document.createElement("div");$(r).addClass("top_holder"),s.prepend(r),this.load=function(){o.each(function(){var e=jQuery(this).wrap('');e.parent().height(e.outerHeight()),jQuery.data(e[0],"pos",e.position().top)})},this.scroll=function(){$(r).css("top",s.scrollTop()),$(r).addClass("z-depth-1"),o.each(function(e){var t=jQuery(this),a=(o.eq(e+1),o.eq(e-1)),l=jQuery.data(t[0],"pos");0==s.scrollTop()?$(r).hide():$(r).show(),l<=s.scrollTop()?($(r).html(""),t.clone().appendTo($(r))):(t.removeAttr("style").show(),a.length>0&&s.offset().top<=jQuery.data(t[0],"pos")-a.outerHeight()&&a.removeClass("absolute").removeAttr("style"))})}}