Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Yutaka Kobayashi
/
jsStudy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 998da855
authored
Jan 19, 2023
by
Yutaka Kobayashi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
constructor内の名前変更
1 parent
ff9e46a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
develop/.tmp/assets/js/home.js
develop/src/assets/js/fadeIn.js
develop/.tmp/assets/js/home.js
View file @
998da85
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
\*********************************/
\*********************************/
/***/
(
function
(
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
{
/***/
(
function
(
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
{
eval
(
"__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Fade\": function() { return /* binding */ Fade; }\n/* harmony export */ });\n/* harmony import */ var throttle_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! throttle-debounce */ \"./node_modules/throttle-debounce/esm/index.js\");\n\nclass Fade {\n constructor() {\n this.
elements = {\n element: document.getElementsByClassName(\"scrollUp\"),\n scrollY: window.pageYOffset,\n windowHeight: window.innerHeight,\n showTiming: 200,\n };\n\n window.addEventListener(\n \"scroll\",\n (0,throttle_debounce__WEBPACK_IMPORTED_MODULE_0__.throttle)(300, () => {\n window.addEventListener(\"scroll\", () => {\n for (let i = 0; i < this.elements.element.length; i++) {\n let elementClientRect =\n this.elements.element[i].getBoundingClientRect();\n let elementY = this.elements.scrollY + elementClientRect.top;\n if (\n scrollY >\n elementY - this.elements.windowHeight + this.elements.showTiming\n ) {\n this.e
lements.element[i].classList.add(\"is-show\");\n }\n }\n });\n })\n );\n }\n}\n\n\n//# sourceURL=webpack://static-boilerplate/./src/assets/js/fadeIn.js?"
);
eval
(
"__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Fade\": function() { return /* binding */ Fade; }\n/* harmony export */ });\n/* harmony import */ var throttle_debounce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! throttle-debounce */ \"./node_modules/throttle-debounce/esm/index.js\");\n\nclass Fade {\n constructor() {\n this.
scrollElements = {\n element: document.getElementsByClassName(\"scrollUp\"),\n };\n this.scrollProperty = {\n scrollY: window.pageYOffset,\n windowHeight: window.innerHeight,\n showTiming: 200,\n };\n\n window.addEventListener(\n \"scroll\",\n (0,throttle_debounce__WEBPACK_IMPORTED_MODULE_0__.throttle)(300, () => {\n window.addEventListener(\"scroll\", () => {\n for (let i = 0; i < this.scrollElements.element.length; i++) {\n let elementClientRect =\n this.scrollElements.element[i].getBoundingClientRect();\n let elementY = this.scrollProperty.scrollY + elementClientRect.top;\n if (\n scrollY >\n elementY -\n this.scrollProperty.windowHeight +\n this.scrollProperty.showTiming\n ) {\n this.scrollE
lements.element[i].classList.add(\"is-show\");\n }\n }\n });\n })\n );\n }\n}\n\n\n//# sourceURL=webpack://static-boilerplate/./src/assets/js/fadeIn.js?"
);
/***/
}),
/***/
}),
...
...
develop/src/assets/js/fadeIn.js
View file @
998da85
import
{
throttle
}
from
"throttle-debounce"
;
import
{
throttle
}
from
"throttle-debounce"
;
export
class
Fade
{
export
class
Fade
{
constructor
()
{
constructor
()
{
this
.
e
lements
=
{
this
.
scrollE
lements
=
{
element
:
document
.
getElementsByClassName
(
"scrollUp"
),
element
:
document
.
getElementsByClassName
(
"scrollUp"
),
};
this
.
scrollProperty
=
{
scrollY
:
window
.
pageYOffset
,
scrollY
:
window
.
pageYOffset
,
windowHeight
:
window
.
innerHeight
,
windowHeight
:
window
.
innerHeight
,
showTiming
:
200
,
showTiming
:
200
,
...
@@ -12,15 +14,17 @@ export class Fade {
...
@@ -12,15 +14,17 @@ export class Fade {
"scroll"
,
"scroll"
,
throttle
(
300
,
()
=>
{
throttle
(
300
,
()
=>
{
window
.
addEventListener
(
"scroll"
,
()
=>
{
window
.
addEventListener
(
"scroll"
,
()
=>
{
for
(
let
i
=
0
;
i
<
this
.
e
lements
.
element
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
scrollE
lements
.
element
.
length
;
i
++
)
{
let
elementClientRect
=
let
elementClientRect
=
this
.
e
lements
.
element
[
i
].
getBoundingClientRect
();
this
.
scrollE
lements
.
element
[
i
].
getBoundingClientRect
();
let
elementY
=
this
.
elements
.
scrollY
+
elementClientRect
.
top
;
let
elementY
=
this
.
scrollProperty
.
scrollY
+
elementClientRect
.
top
;
if
(
if
(
scrollY
>
scrollY
>
elementY
-
this
.
elements
.
windowHeight
+
this
.
elements
.
showTiming
elementY
-
this
.
scrollProperty
.
windowHeight
+
this
.
scrollProperty
.
showTiming
)
{
)
{
this
.
e
lements
.
element
[
i
].
classList
.
add
(
"is-show"
);
this
.
scrollE
lements
.
element
[
i
].
classList
.
add
(
"is-show"
);
}
}
}
}
});
});
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment