سؤال

following the code from this question, I'm trying to add a class to html for handling iPad landscape layout issues.

But the JS to detect iPad iOS7 doesn't seem to work anymore:

if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
}

I tried it on an iPad4 iOS7.

Can anyone confirm that the detection code is working for them?

EDIT: thanks to Waki's test page, we can be sure it is working.

And going through my 800 lines of app code again thoroughly, I found that I called my function that includes the code for the check from within document.ready but the function itself was placed outside of document.ready and therefore was not called. Really stupid mistake. I apologize to all who wasted their time on reading this.

هل كانت مفيدة؟

المحلول

are included jQuery library for use $('html') ? Because this regex is working.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top