-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
143 additions
and
104 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 头部滚动 | ||
(function(){ | ||
let $header = document.querySelector('.header'); | ||
document.addEventListener('scroll',function(){ | ||
let scrollTop = document.documentElement.scrollTop; | ||
let ratio = Math.min(scrollTop/1000,1); | ||
$header.style.background = 'rgba(255,255,255,'+(ratio*0.8)+')'; | ||
$header.style.boxShadow = '1px 1px 6px rgba(0,0,0,'+(ratio*0.1)+')'; | ||
}); | ||
})(); | ||
|
||
// 底部滚动 | ||
(function(){ | ||
let timer = null; | ||
let $gotop = document.querySelector('.mod-fixedbar .gotop'); | ||
$gotop.addEventListener('click',function(){ | ||
cancelAnimationFrame(timer); | ||
let scrollTop = document.body.scrollTop || document.documentElement.scrollTop; | ||
let move = scrollTop/18; | ||
timer = requestAnimationFrame(function fn(){ | ||
var oTop = document.body.scrollTop || document.documentElement.scrollTop; | ||
if(oTop > 0){ | ||
document.body.scrollTop = document.documentElement.scrollTop = oTop - move; | ||
timer = requestAnimationFrame(fn); | ||
}else{ | ||
cancelAnimationFrame(timer); | ||
} | ||
}); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters