Skip to content

Commit 3ea4dea

Browse files
committed
Fix scaleElement method and initialization, bump version to 0.2.1
1 parent 149710a commit 3ea4dea

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

index.html

-10
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,6 @@
9999
height: 100%;
100100
}
101101

102-
.fill {
103-
position: absolute;
104-
top: 50%;
105-
left: 50%;
106-
transform: translate3d(-50%, -50%, 0);
107-
min-width: 100%;
108-
min-height: 100vh;
109-
object-fit: cover;
110-
}
111-
112102
.header-content-wrap {
113103
position: relative;
114104
width: 100%;

jquery.rellax.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* jQuery Rellax Plugin v0.2.0
2+
* jQuery Rellax Plugin v0.2.1
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/
@@ -36,7 +36,7 @@
3636
this.options = $.extend({}, $.fn.rellax.defaults, options);
3737

3838
var self = this,
39-
$el = $(this.element),
39+
$el = $(this.element).addClass('rellax-active'),
4040
myAmount = $el.data('rellax-amount'),
4141
myBleed = $el.data('rellax-bleed');
4242

@@ -68,17 +68,14 @@
6868
oldWidth = this.width,
6969
oldHeight = this.height,
7070
newWidth,
71-
newHeight;
71+
newHeight,
72+
scale;
7273

73-
newHeight = parentHeight + (windowHeight - parentHeight) * this.options.amount;
74-
newWidth = windowWidth;
75-
76-
scale = Math.max(newWidth / oldWidth, newHeight / oldHeight);
74+
scale = Math.max(parentWidth / oldWidth, parentHeight / oldHeight);
7775

7876
this.width = oldWidth * scale;
7977
this.height = oldHeight * scale;
8078

81-
this.offset.top -= (newHeight - parentHeight)/2;
8279
this.offset.left -= (oldWidth * scale - parentWidth)/2;
8380
},
8481
_reloadElement: function() {

jquery.rellax.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)