js-modules/mixins/scrollTo.js

19 lines
428 B
JavaScript
Executable File

export default {
data: function() {
return {
scrollOffset: 0
};
},
methods: {
scrollTo(el) {
var vm = this;
window.setTimeout(function() {
window.jQuery('html, body').animate({
scrollTop: window.jQuery(vm.$refs[el]).offset().top + (vm.scrollOffset * -1)
}, 300);
}, 200);
}
}
};