Skip to content

Commit 9221bd1

Browse files
committed
Add more options
1 parent 7bd3953 commit 9221bd1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ exports.install = function (Vue) {
2929
e.preventDefault()
3030

3131
if (typeof this.value === 'object') {
32-
exports.scrollTo(this.value.el, 500, {
33-
easing: exports.easing['ease'],
34-
offset: this.value.offset
32+
exports.scrollTo(this.value.el || this.value.element , this.value.duration || 500, {
33+
easing: this.value.easing || exports.easing['ease'],
34+
offset: this.value.offset || 0
3535
})
3636
} else {
3737
exports.scrollTo(this.value, 500, {
@@ -69,7 +69,7 @@ exports.scrollTo = function (element, duration, options) {
6969
var initialY = window.pageYOffset
7070
var elementY = initialY + element.getBoundingClientRect().top
7171
var targetY = document.body.scrollHeight - elementY < window.innerHeight ? document.body.scrollHeight - window.innerHeight : elementY
72-
72+
7373
if (options.offset) {
7474
targetY += options.offset
7575
}

0 commit comments

Comments
 (0)