Skip to content

Commit 7a2f1e5

Browse files
committed
build(v2.0.1)
1 parent 0b23569 commit 7a2f1e5

File tree

7 files changed

+41
-37
lines changed

7 files changed

+41
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.lock
44
*.DS_Store
55
node_modules
6+
dev

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#scrollReveal.js
2-
[![scrollReveal version](http://img.shields.io/badge/scrollReveal.js-v2.0.0-brightgreen.svg)](http://scrollrevealjs.org) [![License](http://img.shields.io/badge/License-MIT-blue.svg)](http://opensource.org/licenses/MIT)
2+
[![scrollReveal version](http://img.shields.io/badge/scrollReveal.js-v2.0.1-brightgreen.svg)](http://scrollrevealjs.org) [![License](http://img.shields.io/badge/License-MIT-blue.svg)](http://opensource.org/licenses/MIT)
33

44
### Easily reveal elements as they enter the viewport.
55

66
- Developed for modern browsers
7+
- **3.2KB** minified and Gzipped
78
- An open-source project by [Julian Lloyd](https://twitter.com/julianlloyd)
89

910
***
@@ -15,7 +16,7 @@
1516
Installation
1617
------------
1718

18-
Please use which ever is more comfortable:
19+
Please use which ever is most comfortable:
1920

2021
- [Download ZIP](https://github.com/julianlloyd/scrollReveal.js/archive/master.zip)
2122
- `git clone https://github.com/julianlloyd/scrollReveal.js.git`
@@ -43,7 +44,7 @@ Once you’ve got `scrollReveal.min.js` into your project’s JavaScript directo
4344
Basic Usage
4445
-----------
4546

46-
How does it work? It’s as simple as adding `data-sr` to an element, it will reveal as it enters the viewport.
47+
How does it work? Just add `data-sr` to an element, and it will reveal as it enters the viewport.
4748
```html
4849
<p data-sr> Chips Ahoy! </p>
4950
```
@@ -54,8 +55,8 @@ Taking Control
5455
You guessed it, the `data-sr` attribute is waiting for _you_ to describe the type of animation you want. It’s as simple as using a few **keywords** and natural language.
5556
```html
5657
<div data-sr="enter left please, and hustle 20px"> Foo </div>
57-
<div data-sr="enter bottom and move 50px after 1s"> Bar </div>
58-
<div data-sr="wait 2.5s and then ease-in-out 100px"> Baz </div>
58+
<div data-sr="wait 2.5s and then ease-in-out 100px"> Bar </div>
59+
<div data-sr="enter bottom and scale up 20% over 2s"> Baz </div>
5960
```
6061
What you enter into the `data-sr` attribute is parsed for specific words:
6162

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scrollReveal.js",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"homepage": "https://github.com/julianlloyd/scrollReveal.js",
55
"authors": [
66
"Julian Lloyd <https://twitter.com/julianlloyd>"

dist/scrollReveal.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
___ ___ _ __ ___ | | | |__) |_____ _____ __ _| | _ ___
1616
/ __|/ __| '__/ _ \| | | _ // _ \ \ / / _ \/ _` | | | / __|
1717
\__ \ (__| | | (_) | | | | \ \ __/\ V / __/ (_| | |_| \__ \
18-
|___/\___|_| \___/|_|_|_| \_\___| \_/ \___|\__,_|_(_) |___/ v2.0.0
18+
|___/\___|_| \___/|_|_|_| \_\___| \_/ \___|\__,_|_(_) |___/ v2.0.1
1919
_/ |
2020
|__/
2121
@@ -47,8 +47,12 @@ window.scrollReveal = (function( window ) {
4747

4848
if ( self.isMobile() && !self.config.mobile ) return
4949

50-
window.addEventListener( 'scroll', handler, false )
51-
window.addEventListener( 'resize', handler, false )
50+
if ( self.config.viewport == window.document.documentElement ) {
51+
52+
window.addEventListener( 'scroll', handler, false )
53+
window.addEventListener( 'resize', handler, false )
54+
55+
} else self.config.viewport.addEventListener( 'scroll', handler, false )
5256

5357
self.init()
5458
}
@@ -168,8 +172,6 @@ window.scrollReveal = (function( window ) {
168172
)
169173
}
170174

171-
if ( self.config.delay == 'once' )
172-
173175
/**
174176
* Reset is disabled for this element, so lets restore the style attribute
175177
* to its pre-scrollReveal state after the animation completes.
@@ -183,7 +185,7 @@ window.scrollReveal = (function( window ) {
183185
*/
184186
elem.domEl.setAttribute( 'style', elem.styles.inline )
185187
elem.domEl.setAttribute( 'data-sr-complete', true )
186-
elem.config.complete( elem.docEl )
188+
elem.config.complete( elem.domEl )
187189
/**
188190
* Reveal animation complete.
189191
*/
@@ -343,7 +345,7 @@ window.scrollReveal = (function( window ) {
343345
})
344346

345347
/**
346-
* Build config object from defaults and element
348+
* Build default config object, then apply any
347349
* overrides parsed from the data-sr attribute.
348350
*/
349351
config = extend( config, self.config )
@@ -353,13 +355,13 @@ window.scrollReveal = (function( window ) {
353355
if ( config.enter == 'left' || config.enter == 'right' ) config.axis = 'X'
354356

355357
/**
356-
* Make sure to check for our custom hustle easing
358+
* Make sure to check for our custom hustle easing.
357359
*/
358360
if ( config.easing == 'hustle' ) config.easing = 'cubic-bezier( 0.6, 0.2, 0.1, 1 )'
359361

360362
/**
361363
* Let’s make sure our our pixel distances are negative for top and left.
362-
* e.g. "move 25px from top" starts at 'top: -25px' in CSS.
364+
* e.g. "enter top and move 25px" starts at 'top: -25px' in CSS.
363365
*/
364366
if ( config.enter == 'top' || config.enter == 'left' ) config.move = '-' + config.move
365367

@@ -398,9 +400,6 @@ window.scrollReveal = (function( window ) {
398400
*/
399401
build = function( flag ) {
400402

401-
initial = 'transform:'
402-
target = 'transform:'
403-
404403
if ( parseInt( elem.config.move ) != 0 ) {
405404

406405
initial += ' translate' + elem.config.axis + '(' + elem.config.move + ')'
@@ -418,15 +417,18 @@ window.scrollReveal = (function( window ) {
418417

419418
initial += '; opacity: ' + elem.config.opacity + '; '
420419
target += '; opacity: 1; ';
420+
}
421421

422-
if ( flag ) {
422+
initial = 'transform:'
423+
target = 'transform:'
423424

424-
initial += '-webkit-transform:'
425-
target += '-webkit-transform:'
425+
build()
426426

427-
build( false )
428-
}
429-
}
427+
/**
428+
* And again for webkit…
429+
*/
430+
initial += '-webkit-transform:'
431+
target += '-webkit-transform:'
430432

431433
build()
432434

0 commit comments

Comments
 (0)