Forum Discussion
gmorken
Nov 08, 2020Copper Contributor
Hiding siteheader and shyheader casues flickering when scrolling
Hi! I know that it is not best practice from Microsoft to hide the header but this is just for our local intranet where we are trying to build a custom mega menu with an application customizer. ...
elkolorado
Mar 14, 2024Copper Contributor
Avail, here is ur 2024 code... to disable the header, and the flickering.
<script>
// disable flickering after hiding the header & shy header
window['__shyConductor']._totalHeightDifference = 0;
</script>
<style>
#spSiteHeader /* disable shy & page header bar */ {
display: none !important;
}
/* optional cleanup */
#sp-appBar, /* disable left nav bar */
#spCommandBar, /* disable command bar */
[data-automation-id=pageHeader] /* disable title bar */
{
display: none !important;
}
</style>
The _shyConductor is object that contains all functions for the shy header inside Microsoft Sharepoint Page. By setting heightDifference to 0, we are just quickly ignoring any change to update the scrollTop. You could use any other function of shyHeader instance to disable that as well, but I found this the simplest trick in the book.
Helped? Follow me on https://github.com/elkolorado
gmorken
Mar 14, 2024Copper Contributor
elkolorado nice thx!