Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Oct 21, 2013

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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.