Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "g-scroll", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "GScroll is a lightweight javascript tool to trigger a function when you scroll to a DOM.", | ||
@@ -5,0 +5,0 @@ "main": "lib/g-scroll.js", |
# GScroll | ||
#####GScroll is a lightweight javascript tool to trigger a function when you scroll to a DOM. | ||
##### GScroll is a lightweight javascript tool to trigger a function when you scroll to a DOM. | ||
[Live demo](https://ga-mo.github.io/g-scroll/demo/) | ||
@@ -18,1 +18,43 @@ | ||
You can [download the source](https://github.com/GA-MO/g-scroll/tree/master/lib) as well. :) | ||
#### Properties: | ||
```js | ||
selector: '.element', // Class name for trigger | ||
offset: 10, // Offset point for trigger | ||
delay: 0.5, // Time delay before call action | ||
action: function(selector) { | ||
// this function will trigger when DOM in viewpoit | ||
// (selector) is current DOM in viewpoit | ||
// can use (selector) make a great thing with your favorite lib. | ||
} | ||
``` | ||
#### Example: | ||
```js | ||
// Set up properties | ||
var dataScroll = [ | ||
{ | ||
selector: '.element1', | ||
offset: 10, | ||
delay: 0.5, | ||
action: function(selector) { | ||
TweenMax.from(selector, 0.3, { y:100, opacity: 0 }); | ||
} | ||
}, | ||
{ | ||
selector: '.element2', | ||
offset: 10, | ||
delay: 0.5, | ||
action: function(selector) { | ||
alert('Trigger me'); | ||
$(selector).addClass('animated'); | ||
} | ||
} | ||
]; | ||
// Use | ||
GScroll(dataScroll); | ||
``` |
Sorry, the diff of this file is not supported yet
4807
60