Skip to content

Commit 502db21

Browse files
committed
small position fix, bump version to 0.3.3
1 parent d691e42 commit 502db21

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

jquery.rellax.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Rellax Plugin v0.3.2
2+
* jQuery Rellax Plugin v0.3.3
33
* Examples and documentation at http://pixelgrade.github.io/rellax/
44
* Copyright (c) 2016 PixelGrade http://www.pixelgrade.com
55
* Licensed under MIT http://www.opensource.org/licenses/mit-license.php/
@@ -44,20 +44,15 @@
4444
this.height = this.$el.outerHeight();
4545
this.width = this.$el.outerWidth();
4646

47-
this.offset.top -= this.options.bleed;
48-
this.height += 2 * this.options.bleed;
49-
50-
if ( this.parent === undefined && this.$parent.length ) {
51-
var parentHeight = this.$parent.outerHeight();
52-
53-
this.height = windowHeight - ( windowHeight - parentHeight ) * ( 1 - this.options.amount );
54-
this.offset.top = ( parentHeight - this.height ) / 2;
47+
if ( this.parent === undefined ) {
48+
this.offset.top -= this.options.bleed;
49+
this.height += 2 * this.options.bleed;
5550
}
5651
},
5752
_scaleElement: function() {
5853
var parentHeight = this.$parent.outerHeight(),
5954
parentWidth = this.$parent.outerWidth(),
60-
scaleY = parentHeight / this.height,
55+
scaleY = ( parentHeight + ( windowHeight - parentHeight ) * ( 1 - this.options.amount ) ) / this.height,
6156
scaleX = parentWidth / this.width,
6257
scale = Math.max(scaleX, scaleY);
6358

@@ -68,7 +63,7 @@
6863
this.offset.left = ( parentWidth - this.width ) / 2;
6964
},
7065
_prepareElement: function() {
71-
if ( this.parent == undefined ) {
66+
if ( this.parent === undefined ) {
7267
this.$el.addClass( 'rellax-element' );
7368
this.$el.css({
7469
position: 'fixed',

0 commit comments

Comments
 (0)