|
1 | 1 | /*!
|
2 |
| - * jQuery Rellax Plugin v0.3.2 |
| 2 | + * jQuery Rellax Plugin v0.3.3 |
3 | 3 | * Examples and documentation at http://pixelgrade.github.io/rellax/
|
4 | 4 | * Copyright (c) 2016 PixelGrade http://www.pixelgrade.com
|
5 | 5 | * Licensed under MIT http://www.opensource.org/licenses/mit-license.php/
|
|
44 | 44 | this.height = this.$el.outerHeight();
|
45 | 45 | this.width = this.$el.outerWidth();
|
46 | 46 |
|
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; |
55 | 50 | }
|
56 | 51 | },
|
57 | 52 | _scaleElement: function() {
|
58 | 53 | var parentHeight = this.$parent.outerHeight(),
|
59 | 54 | parentWidth = this.$parent.outerWidth(),
|
60 |
| - scaleY = parentHeight / this.height, |
| 55 | + scaleY = ( parentHeight + ( windowHeight - parentHeight ) * ( 1 - this.options.amount ) ) / this.height, |
61 | 56 | scaleX = parentWidth / this.width,
|
62 | 57 | scale = Math.max(scaleX, scaleY);
|
63 | 58 |
|
|
68 | 63 | this.offset.left = ( parentWidth - this.width ) / 2;
|
69 | 64 | },
|
70 | 65 | _prepareElement: function() {
|
71 |
| - if ( this.parent == undefined ) { |
| 66 | + if ( this.parent === undefined ) { |
72 | 67 | this.$el.addClass( 'rellax-element' );
|
73 | 68 | this.$el.css({
|
74 | 69 | position: 'fixed',
|
|
0 commit comments