Skip to content

Commit

Permalink
Disable fade animation if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Gomez committed Aug 20, 2019
1 parent f8dde76 commit b6380ea
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion assets/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
"desktop": "assets/screenshot-desktop.jpg",
"mobile": "assets/screenshot-mobile.jpg"
},
"version": "0.2.3"
"version": "0.2.4"
}
12 changes: 8 additions & 4 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,14 @@ $(document).ready(() => {
})
}

AOS.init({
once: true,
startEvent: 'DOMContentLoaded',
})
if (typeof disableFadeAnimation === 'undefined' || !disableFadeAnimation) {
AOS.init({
once: true,
startEvent: 'DOMContentLoaded',
})
} else {
$('[data-aos]').addClass('no-aos-animation')
}

tippy('.js-tooltip')

Expand Down
18 changes: 9 additions & 9 deletions src/sass/libs/aos/_animations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $aos-distance: 100px !default;
* fade-up-right, fade-up-left, fade-down-right, fade-down-left
*/

[data-aos^='fade'][data-aos^='fade'] {
[data-aos^='fade'][data-aos^='fade']:not(.no-aos-animation) {
opacity: 0;
transition-property: opacity, transform;

Expand All @@ -18,34 +18,34 @@ $aos-distance: 100px !default;
}
}

[data-aos='fade-up'] {
[data-aos='fade-up']:not(.no-aos-animation) {
transform: translate3d(0, $aos-distance, 0);
}

[data-aos='fade-down'] {
[data-aos='fade-down']:not(.no-aos-animation) {
transform: translate3d(0, -$aos-distance, 0);
}

[data-aos='fade-right'] {
[data-aos='fade-right']:not(.no-aos-animation) {
transform: translate3d(-$aos-distance, 0, 0);
}

[data-aos='fade-left'] {
[data-aos='fade-left']:not(.no-aos-animation) {
transform: translate3d($aos-distance, 0, 0);
}

[data-aos='fade-up-right'] {
[data-aos='fade-up-right']:not(.no-aos-animation) {
transform: translate3d(-$aos-distance, $aos-distance, 0);
}

[data-aos='fade-up-left'] {
[data-aos='fade-up-left']:not(.no-aos-animation) {
transform: translate3d($aos-distance, $aos-distance, 0);
}

[data-aos='fade-down-right'] {
[data-aos='fade-down-right']:not(.no-aos-animation) {
transform: translate3d(-$aos-distance, -$aos-distance, 0);
}

[data-aos='fade-down-left'] {
[data-aos='fade-down-left']:not(.no-aos-animation) {
transform: translate3d($aos-distance, -$aos-distance, 0);
}

0 comments on commit b6380ea

Please sign in to comment.