Skip to content

Commit 39d790d

Browse files
committed
images static on Android as Spotify
1 parent 6664ce6 commit 39d790d

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

parallax.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,26 @@
9999
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
100100
if (this.iosFix && !this.$element.is('img')) {
101101
this.$element.css({
102-
backgroundImage: 'url(' + encodeURIComponent(this.imageSrc) + ')',
102+
backgroundImage: 'url(' + this.imageSrc + ')',
103103
backgroundSize: 'cover',
104104
backgroundPosition: this.position
105105
});
106106
}
107107
return this;
108108
}
109+
110+
if (navigator.userAgent.match(/(Android)/)) {
111+
if (this.androidFix && !this.$element.is('img')) {
112+
this.$element.css({
113+
backgroundImage: 'url(' + this.imageSrc + ')',
114+
backgroundSize: 'cover',
115+
backgroundPosition: this.position
116+
});
117+
}
118+
return this;
119+
}
120+
121+
109122

110123
this.$mirror = $('<div />').prependTo('body');
111124
this.$slider = $('<img />').prependTo(this.$mirror);
@@ -148,7 +161,8 @@
148161
bleed: 0,
149162
zIndex: -100,
150163
iosFix: true,
151-
position: 'center',
164+
androidFix: true,
165+
position: 'center',
152166

153167
refresh: function() {
154168
this.boxWidth = this.$element.width();
@@ -340,4 +354,4 @@
340354
$('[data-parallax="scroll"]').parallax();
341355
});
342356

343-
}(jQuery, window, document));
357+
}(jQuery, window, document));

parallax.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)