@@ -77,9 +77,11 @@ var header = (function() {
7777
7878 var _renderShade = function ( ) {
7979 var html = helper . e ( "html" ) ;
80+ var headerRect = helper . e ( ".header" ) . getBoundingClientRect ( ) ;
81+ var layoutRect = helper . e ( ".layout" ) . getBoundingClientRect ( ) ;
8082 var fontSize = parseInt ( getComputedStyle ( html ) . fontSize , 10 ) ;
8183 var scrollTop = document . documentElement . scrollTop ;
82- var scrollHeight = document . documentElement . scrollHeight ;
84+ // var scrollHeight = document.documentElement.scrollHeight;
8385 var innerHeight = window . innerHeight ;
8486 // if shade show
8587 if ( state . get ( ) . header . shade . show ) {
@@ -91,16 +93,16 @@ var header = (function() {
9193 } else if ( state . get ( ) . header . shade . style == "scroll" ) {
9294 helper . removeClass ( html , "is-header-shade-style-always" ) ;
9395 // check header position
94- if ( state . get ( ) . layout . order == "headerLink " ) {
96+ if ( state . get ( ) . layout . order == "headerlink " ) {
9597 // check scroll position
96- if ( scrollTop > fontSize * 2 ) {
98+ if ( scrollTop > fontSize * 2 && headerRect . top == 0 ) {
9799 helper . addClass ( html , "is-header-shade-style-scroll" ) ;
98100 } else {
99101 helper . removeClass ( html , "is-header-shade-style-scroll" ) ;
100102 } ;
101103 } else if ( state . get ( ) . layout . order == "linkheader" ) {
102104 // check scroll position
103- if ( scrollTop < ( scrollHeight - innerHeight ) - ( fontSize * 2 ) ) {
105+ if ( headerRect . bottom == innerHeight && ( scrollTop + innerHeight ) < ( ( scrollTop + layoutRect . bottom ) - ( fontSize * 2 ) ) ) {
104106 helper . addClass ( html , "is-header-shade-style-scroll" ) ;
105107 } else {
106108 helper . removeClass ( html , "is-header-shade-style-scroll" ) ;
0 commit comments