Skip to content

Commit 11dabcb

Browse files
committed
renamed translateX, translateY, translateZ properties to x, y, z
1 parent 810d55c commit 11dabcb

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ bower install jquery-easy-parallax
2424
Either use data attributes:
2525

2626
```html
27-
<div data-parallax='{"translateY":"70%","scale":2,"rotate":180,"opacity":0}'></div>
27+
<div data-parallax='{"y":"70%","scale":2,"rotate":180,"opacity":0}'></div>
2828
```
2929

3030
or javascript:
3131

3232
```javascript
3333
$("#selector").parallax({
34-
"translateY": "70%",
34+
"y": "70%",
3535
"scale": 2,
3636
"rotate": 180,
3737
"opacity": 0
@@ -49,11 +49,11 @@ To specify a **from** value as well **to**, use the object syntax:
4949

5050
### Available properties:
5151

52-
translateX
52+
x
5353

54-
translateY
54+
y
5555

56-
translateZ
56+
z
5757

5858
scale
5959

@@ -72,7 +72,7 @@ Options can be specified for all properties:
7272
or each individually:
7373

7474
```html
75-
<div data-parallax='{"translateY":"70%","opacity":{"to":1,"from":0,"duration":"85%"},"duration":"150%"}'></div>
75+
<div data-parallax='{"y":"70%","opacity":{"to":1,"from":0,"duration":"85%"},"duration":"150%"}'></div>
7676
```
7777

7878
### Available options:

examples/hero-bg.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link rel="stylesheet" href="css/examples.css" type="text/css">
88
<body>
99
<section class="hero">
10-
<div class="hero-bg" data-parallax='{"translateY":"70%"}'></div>
10+
<div class="hero-bg" data-parallax='{"y":"70%"}'></div>
1111
<div class="hero-content">
1212
<h1>jquery-easy-parallax</h1>
1313
<p>Uses a single ticking requestAnimationFrame() method and translate3d to ensure GPU acceleration.</p>

jquery.parallax.js

+20-20
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@
8080
duration: options.duration
8181
},
8282
animation = {};
83-
if (typeof options.translateX != "undefined") {
84-
var translateXOptions = mergeOptions(options.translateX, globalOptions);
85-
animation.translateX = new Scene($this, translateXOptions, windowHeight);
83+
if (typeof options.x != "undefined") {
84+
var xOptions = mergeOptions(options.x, globalOptions);
85+
animation.x = new Scene($this, xOptions, windowHeight);
8686
}
87-
if (typeof options.translateY != "undefined") {
88-
var translateYOptions = mergeOptions(options.translateY, globalOptions);
89-
animation.translateY = new Scene($this, translateYOptions, windowHeight);
87+
if (typeof options.y != "undefined") {
88+
var yOptions = mergeOptions(options.y, globalOptions);
89+
animation.y = new Scene($this, yOptions, windowHeight);
9090
}
91-
if (typeof options.translateZ != "undefined") {
92-
var translateZOptions = mergeOptions(options.translateZ, globalOptions);
93-
animation.translateZ = new Scene($this, translateZOptions, windowHeight);
91+
if (typeof options.z != "undefined") {
92+
var zOptions = mergeOptions(options.z, globalOptions);
93+
animation.z = new Scene($this, zOptions, windowHeight);
9494
}
9595
if (typeof options.scale != "undefined") {
9696
var scaleOptions = mergeOptions(options.scale, globalOptions, 1);
@@ -100,7 +100,7 @@
100100
var rotateOptions = mergeOptions(options.rotate, globalOptions);
101101
animation.rotate = new Scene($this, rotateOptions, 360);
102102
}
103-
if (animation.translateX || animation.translateY || animation.translateZ || animation.scale || animation.rotate) {
103+
if (animation.x || animation.y || animation.z || animation.scale || animation.rotate) {
104104
animation.transform = new Transform(new TransformMatrix());
105105
}
106106

@@ -146,14 +146,14 @@
146146
animation = animations[i];
147147
if (animation.transform) {
148148
TransformMatrix.fromEl(this, animation.transform.matrix);
149-
if (animation.translateX && animation.translateX.updateState()) {
150-
animation.transform.setTranslateX(animation.translateX.value());
149+
if (animation.x && animation.x.updateState()) {
150+
animation.transform.setTranslateX(animation.x.value());
151151
}
152-
if (animation.translateY && animation.translateY.updateState()) {
153-
animation.transform.setTranslateY(animation.translateY.value());
152+
if (animation.y && animation.y.updateState()) {
153+
animation.transform.setTranslateY(animation.y.value());
154154
}
155-
if (animation.translateZ && animation.translateZ.updateState()) {
156-
animation.transform.setTranslateZ(animation.translateZ.value());
155+
if (animation.z && animation.z.updateState()) {
156+
animation.transform.setTranslateZ(animation.z.value());
157157
}
158158
if (animation.scale && animation.scale.updateState()) {
159159
animation.transform.setScale(animation.scale.value());
@@ -315,12 +315,12 @@
315315
this.rotate = angle;
316316
},
317317
toString: function() {
318-
var translateX = (typeof this.translateX != "undefined" ? this.translateX : this.matrix.getTranslateX()).toFixed(2),
319-
translateY = (typeof this.translateY != "undefined" ? this.translateY : this.matrix.getTranslateY()).toFixed(2),
320-
translateZ = (typeof this.translateZ != "undefined" ? this.translateZ : this.matrix.getTranslateZ()).toFixed(2),
318+
var x = (typeof this.translateX != "undefined" ? this.translateX : this.matrix.getTranslateX()).toFixed(2),
319+
y = (typeof this.translateY != "undefined" ? this.translateY : this.matrix.getTranslateY()).toFixed(2),
320+
z = (typeof this.translateZ != "undefined" ? this.translateZ : this.matrix.getTranslateZ()).toFixed(2),
321321
scale = (typeof this.scale != "undefined" ? this.scale : this.matrix.getScale()),
322322
rotate = (typeof this.rotate != "undefined" ? this.rotate : this.matrix.getRotation()),
323-
string = 'translate3d('+translateX+'px, '+translateY+'px, '+translateZ+'px)';
323+
string = 'translate3d('+x+'px, '+y+'px, '+z+'px)';
324324
if (scale != 1) {
325325
string += ' scale('+scale+')';
326326
}

0 commit comments

Comments
 (0)