Skip to content

Commit 7803679

Browse files
committed
Ensure existing behaviour without delay
1 parent 9085e49 commit 7803679

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

dist/vue-scroll-behavior.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/helpers.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@ export function getScrollPosition () {
3232
* Setting Scroll Position
3333
*/
3434
export function setScrollPosition (Vue, position = {x: 0, y: 0}) {
35-
setTimeout(() => {
35+
if (vueScrollBehavior._delay > 0) {
36+
setTimeout(() => {
37+
Vue.nextTick(() => {
38+
window.scrollTo(position.x, position.y)
39+
})
40+
}, vueScrollBehavior._delay);
41+
} else {
3642
Vue.nextTick(() => {
3743
window.scrollTo(position.x, position.y)
3844
})
39-
}, vueScrollBehavior._delay);
45+
}
4046
}
4147

4248
/**

0 commit comments

Comments
 (0)