mirror of https://github.com/IoTcat/sakura2.git
parent
b02591c02f
commit
cb65d01119
5 changed files with 71 additions and 22 deletions
@ -0,0 +1,32 @@ |
|||||||
|
/** |
||||||
|
* @description Sakura theme module |
||||||
|
* @author Mashiro |
||||||
|
* @since 19/10/31 |
||||||
|
* @license MIT |
||||||
|
*/ |
||||||
|
|
||||||
|
import Parallax from 'parallax-js' |
||||||
|
|
||||||
|
/** |
||||||
|
* Initial index cover image and image box. |
||||||
|
* Include Parallax box initial and `#cover-img-container` size initial. |
||||||
|
*/ |
||||||
|
export default function () { |
||||||
|
let coverImageContainer: HTMLElement = document.querySelector("#cover-img-container") |
||||||
|
coverImageContainer.style.height = `${window.innerHeight}px` |
||||||
|
|
||||||
|
let scene = document.querySelector('#cover-img-container') |
||||||
|
let parallaxInstance = new Parallax(scene); |
||||||
|
|
||||||
|
let cover: { |
||||||
|
e: HTMLImageElement, |
||||||
|
w: number, |
||||||
|
h: number |
||||||
|
} |
||||||
|
|
||||||
|
cover.e = document.querySelector("#cover-img") as HTMLImageElement |
||||||
|
cover.w = cover.e.naturalWidth |
||||||
|
cover.h = cover.e.naturalHeight |
||||||
|
|
||||||
|
console.log(cover.w) |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
/** |
||||||
|
* @description Sakura theme module |
||||||
|
* @author Mashiro |
||||||
|
* @since 19/10/31 |
||||||
|
* @license MIT |
||||||
|
*/ |
||||||
|
|
||||||
|
import scrollDirection from "./scrollDirection" |
||||||
|
|
||||||
|
/** |
||||||
|
* Site top bar handler when page scroll |
||||||
|
*/ |
||||||
|
export default function () { |
||||||
|
let ele: HTMLElement = document.querySelector("#nav-header") |
||||||
|
if (scrollDirection('y') == 'down') { |
||||||
|
ele.style.top = `-120px` |
||||||
|
} |
||||||
|
else if (scrollDirection('y') == 'up') { |
||||||
|
ele.style.top = `0px` |
||||||
|
} |
||||||
|
} |
@ -1 +0,0 @@ |
|||||||
export * from './scrollEvent'; |
|
Loading…
Reference in new issue