Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nuxt3 #562

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions dist/scrollreveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
scale: 1,
cleanup: false,
container: document.documentElement,
container: typeof document !=='undefined'? document.documentElement:'',
desktop: true,
mobile: true,
reset: false,
Expand All @@ -49,7 +49,7 @@
};

function failure() {
document.documentElement.classList.remove('sr');
typeof document !=='undefined'?document.documentElement.classList.remove('sr'):'';

return {
clean: function clean() {},
Expand All @@ -63,12 +63,12 @@
}

function success() {
document.documentElement.classList.add('sr');
typeof document !=='undefined'?document.documentElement.classList.add('sr'):'';

if (document.body) {
if (typeof document !=='undefined'&&document.body) {
document.body.style.height = '100%';
} else {
document.addEventListener('DOMContentLoaded', function () {
typeof document !=='undefined' && document.addEventListener('DOMContentLoaded', function () {
document.body.style.height = '100%';
});
}
Expand Down Expand Up @@ -517,7 +517,7 @@

var getPrefixedCssProp = (function () {
var properties = {};
var style = document.documentElement.style;
var style = typeof document !=='undefined'? document.documentElement.style:{};

function getPrefixedCssProperty(name, source) {
if ( source === void 0 ) source = style;
Expand Down Expand Up @@ -1317,10 +1317,10 @@
}
})();

var miniraf = window.requestAnimationFrame ||
var miniraf = typeof window !=='undefined'? window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
polyfill$1;
polyfill$1 :'';

function getGeometry(target, isContainer) {
/**
Expand Down Expand Up @@ -1358,7 +1358,7 @@

function getScrolled(container) {
var top, left;
if (container.node === document.documentElement) {
if (typeof document !=='undefined' &&container.node === document.documentElement) {
top = window.pageYOffset;
left = window.pageXOffset;
} else {
Expand Down Expand Up @@ -1452,12 +1452,12 @@
}

function isTransformSupported() {
var style = document.documentElement.style;
var style =typeof document !=='undefined' ? document.documentElement.style:{};
return 'transform' in style || 'WebkitTransform' in style
}

function isTransitionSupported() {
var style = document.documentElement.style;
var style = typeof document !=='undefined' ? document.documentElement.style:{};
return 'transition' in style || 'WebkitTransition' in style
}

Expand Down
2 changes: 1 addition & 1 deletion src/instance/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
},
scale: 1,
cleanup: false,
container: document.documentElement,
container: typeof document !=='undefined'?document.documentElement:{},
desktop: true,
mobile: true,
reset: false,
Expand Down
14 changes: 7 additions & 7 deletions src/instance/mount.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function failure() {
document.documentElement.classList.remove('sr')
typeof document !=='undefined'&&document.documentElement.classList.remove('sr')

return {
clean() {},
Expand All @@ -13,14 +13,14 @@ function failure() {
}

function success() {
document.documentElement.classList.add('sr')
typeof document !=='undefined'?document.documentElement.classList.add('sr'):'';

if (document.body) {
document.body.style.height = '100%'
if (typeof document !=='undefined'&&document.body) {
document.body.style.height = '100%';
} else {
document.addEventListener('DOMContentLoaded', () => {
document.body.style.height = '100%'
})
typeof document !=='undefined' && document.addEventListener('DOMContentLoaded', function () {
document.body.style.height = '100%';
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/get-scrolled.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function getScrolled(container) {
let top, left
if (container.node === document.documentElement) {
if (typeof document !=='undefined' &&container.node === document.documentElement) {
top = window.pageYOffset
left = window.pageXOffset
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/is-transform-supported.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function isTransformSupported() {
const style = document.documentElement.style
const style = typeof document !=='undefined'?document.documentElement.style:{}
return 'transform' in style || 'WebkitTransform' in style
}
2 changes: 1 addition & 1 deletion src/utils/is-transition-supported.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function isTransitionSupported() {
const style = document.documentElement.style
const style =typeof document !=='undefined'? document.documentElement.style:{}
return 'transition' in style || 'WebkitTransition' in style
}