Skip to content
Closed
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
32 changes: 32 additions & 0 deletions dist/vue-scroll-reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ var sr = require('scrollreveal')();

var VueScrollReveal = {
install: function install(Vue) {
// Add an instance method so we can fire from function
Vue.prototype.$reveal = function (el, options, int) {
return sr.reveal(el, options, int)
}
Vue.directive('scroll-reveal', {
inserted: function inserted(el, binding) {
var options = binding.value || {};
Expand All @@ -21,6 +25,34 @@ var VueScrollReveal = {
}
}

// Added values so we can set some Scroll Reveal options via the directive
if (binding.value) {
// Where should the component originate from
if (binding.value.origin) {
options.origin = binding.value.origin
}

// How far should it travel
if (binding.value.distance) {
options.distance = binding.value.distance
}

// What should the duration be
if (binding.value.duration) {
options.duration = binding.value.duration
}

// Starting opacity
if (binding.value.opacity) {
options.opacity = binding.value.opacity
}

// Starting scale
if (binding.value.scale) {
options.scale = binding.value.scale
}
}

sr.reveal(el, options);
}
});
Expand Down