Browse Source

Move ios check into function

pm2
Luke Childs 8 years ago
parent
commit
7232271d72
  1. 19
      public/assets/enhancements.js

19
public/assets/enhancements.js

@ -1,5 +1,16 @@
(function() { (function() {
// Add ios class to body on iOS devices
function iosBodyClass() {
if(
/iPad|iPhone|iPod/.test(navigator.userAgent)
&& !window.MSStream
&& document.body.classList
) {
document.body.classList.add('ios');
}
}
// Check if DOM has already loaded as we're loading async // Check if DOM has already loaded as we're loading async
['interactive', 'complete'].indexOf(document.readyState) >= 0 ['interactive', 'complete'].indexOf(document.readyState) >= 0
? init() ? init()
@ -9,13 +20,7 @@
function init() { function init() {
// Check for iOS // Check for iOS
if( iosBodyClass();
/iPad|iPhone|iPod/.test(navigator.userAgent)
&& !window.MSStream
&& document.body.classList
) {
document.body.classList.add('ios');
}
} }
})(); })();

Loading…
Cancel
Save