Skip to content

Instantly share code, notes, and snippets.

@srobbin
Created October 8, 2013 23:52
Show Gist options
  • Save srobbin/6893837 to your computer and use it in GitHub Desktop.
Save srobbin/6893837 to your computer and use it in GitHub Desktop.
A quick workaround for Backstretch on iOS7
if (navigator.userAgent.match(/(iPad|iPhone);.*CPU.*OS 7_\d/i)) {
$("body").css({
"background": "url(path/to/image.jpg) center center no-repeat",
"background-size": "cover"
});
} else {
$.backstretch("path/to/image.jpg");
}
@tidygraphic
Copy link

I think this needs 'iPad' removing as it produced some weird results for me with it in (there's no bottom UI on iOS7 iPad Safari). All fine without it though, thanks!

@BillyJC
Copy link

BillyJC commented Jun 20, 2014

Hi Scott,
Thank you so much for your wonderful Backstretch! For months I had been looking for code to use on welcome pages with multiple/random backgrounds. Your code not only does exactly what I wanted, but it does it very well, even in older browsers like IE8. Thank you again so very much. -Billy
Test page: http://www.guyarseneau.com/welcome-summer-test.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment