Skip to content

Commit 344d118

Browse files
committed
minor adjustments
1 parent 71504b8 commit 344d118

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>jQuery Rellax Plugin Demo and Documentation</title>
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
77
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
88
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto+Slab:700">
99
<link rel="stylesheet" type="text/css" href="assets/css/prism.css">
@@ -254,6 +254,8 @@
254254
left: 50%;
255255
width: 1em;
256256
height: 1em;
257+
margin-top: -0.5em;
258+
margin-left: -0.5em;
257259
border: 0.5em solid black;
258260
border-radius: 50% 50% 0 50%;
259261
transform: rotate(45deg);

jquery.rellax.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
$window.on( 'load', function() {
4949
reloadAll();
5050
prepareAll();
51-
updateAll( true );
51+
requestAnimationFrame(function() {
52+
updateAll( true );
53+
});
5254
$.each(elements, function(i, element) {
5355
element.$el.addClass( 'rellax-active' );
5456
});
@@ -112,6 +114,9 @@
112114
this.height = this.$el.outerHeight();
113115
this.width = this.$el.outerWidth();
114116

117+
this.offset.top -= this.options.bleed;
118+
this.height += 2 * this.options.bleed;
119+
115120
if ( this.parent !== undefined ) {
116121
this.height = windowHeight - ( windowHeight - this.parent.height ) * ( 1 - this.options.amount );
117122
this.offset.top = ( this.parent.height - this.height ) / 2;
@@ -128,7 +133,10 @@
128133
if ( this.parent == undefined ) {
129134
this.$el.addClass( 'rellax-element' );
130135
this.$el.css({
136+
position: 'fixed',
137+
left: this.offset.left,
131138
top: this.offset.top,
139+
width: this.width,
132140
height: this.height
133141
});
134142
} else {
@@ -195,7 +203,7 @@
195203
$.fn.rellax.defaults = {
196204
amount: 0.5,
197205
bleed: 0,
198-
scale: 1.2,
206+
scale: 1,
199207
container: '[data-rellax-container]'
200208
};
201209

0 commit comments

Comments
 (0)