Skip to content

Commit ece21d3

Browse files
committed
Modify readme to reflect updates
1 parent c7a80e7 commit ece21d3

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

README.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This will look for any parallax backgrounds or elements within the specified ele
3333

3434
Support in Mobile WebKit browsers requires a touch scrolling library, and a slightly tweaked configuration. For a full walkthrough on how to implement this correctly, read my blog post ["Mobile Parallax with Stellar.js"](http://markdalgleish.com/2012/10/mobile-parallax-with-stellar-js).
3535

36-
Please note that parallax backgrounds are not recommended in Mobile WebKit, only parallax elements.
36+
Please note that parallax backgrounds are not recommended in Mobile WebKit due to performance constraints. Instead, use parallax elements with static backgrounds.
3737

3838
## Parallax Elements
3939

@@ -183,18 +183,11 @@ If your method for creating a scrolling interface isn't covered by one of these,
183183

184184
``` js
185185
$.stellar.scrollProperty.margin = {
186-
getTop: function($element) {
187-
return parseInt($element.css('margin-top'), 10) * -1;
188-
},
189-
setTop: function($element, val) {
190-
$element.css('margin-top', val);
191-
},
192-
193186
getLeft: function($element) {
194187
return parseInt($element.css('margin-left'), 10) * -1;
195188
},
196-
setLeft: function($element, val) {
197-
$element.css('margin-left', val);
189+
getTop: function($element) {
190+
return parseInt($element.css('margin-top'), 10) * -1;
198191
}
199192
}
200193
```
@@ -232,6 +225,27 @@ $.stellar({
232225
});
233226
```
234227

228+
If, for technical reasons, you need to set both properties at once, you can define a single 'setPosition' function:
229+
230+
``` js
231+
$.stellar.positionProperty.foobar = {
232+
setPosition: function($element, newLeft, originalLeft, newTop, originalTop) {
233+
$element.css('transform', 'translate3d(' +
234+
(newLeft - originalLeft) + 'px, ' +
235+
(newTop - originalTop) + 'px, ' +
236+
'0)');
237+
}
238+
}
239+
```
240+
241+
Now, you can specify this position property in Stellar.js' configuration.
242+
243+
``` js
244+
$.stellar({
245+
positionProperty: 'foobar'
246+
});
247+
```
248+
235249
## Package Managers
236250

237251
Stellar.js can be installed with the following tools.
@@ -266,29 +280,29 @@ I'm sure there are heaps more. [Let me know if you'd like me to feature your sit
266280

267281
## How to Build
268282

269-
Stellar.js uses [Grunt](http://gruntjs.com) and [PhantomJS](http://phantomjs.org/).
270-
271-
Once you've got Grunt and PhantomJS set up, you can validate, test, concatenate and minify the project with the following command:
283+
Stellar.js uses [Node.js](nodejs.org), [Grunt](http://gruntjs.com) and [PhantomJS](http://phantomjs.org/).
272284

273-
`grunt`
285+
Once you've got Node and PhantomJS set up, install the dependencies:
274286

275-
Each of the build steps are also available individually.
287+
`$ npm install`
276288

277-
To test the code using QUnit and PhantomJS:
289+
To lint, test and minify the project, simply run the following command:
278290

279-
`grunt qunit`
291+
`$ grunt`
280292

281-
To validate the code using JSHint:
293+
Each of the build steps are also available individually.
282294

283-
`grunt lint`
295+
`$ grunt test` to test the code using QUnit and PhantomJS:
284296

285-
To continuously validate and test the code while developing:
297+
`$ grunt lint` to validate the code using JSHint.
286298

287-
`grunt watch`
299+
`$ grunt watch` to continuously lint and test the code while developing.
288300

289301
## Contributing to Stellar.js
290302

291-
Make sure that all plugin changes are made in `src/jquery.stellar.js` (`/jquery.stellar.js` and `/jquery.stellar.min.js` are generated by Grunt), and that you successfully test and build the project with `grunt` before committing.
303+
Ensure that you successfully test and build the project with `$ grunt` before committing.
304+
305+
Make sure that all plugin changes are made in `src/jquery.stellar.js` (`/jquery.stellar.js` and `/jquery.stellar.min.js` are generated by Grunt).
292306

293307
If you want to contribute in a way that changes the API, please file an issue before submitting a pull request so we can discuss how to appropriately integrate your ideas.
294308

0 commit comments

Comments
 (0)