Skip to content
Snippets Groups Projects
Commit e5972e7b authored by Steven H Johnson's avatar Steven H Johnson
Browse files

Fix mobileview not detecting mobile on webkit

parent 06024747
Branches
No related merge requests found
function isSizeMobile(size) {
// webkit removes double quotes
if (size == '"mobile"' || size == 'mobile')
return true;
return false;
}
function isSizeWidescreen(size) {
// webkit removes double quotes
if (size == '"widescreen"' || size == 'widescreen')
return true;
return false;
}
// Ensure entire page loads first. // Ensure entire page loads first.
$(document).ready(function() { $(document).ready(function() {
...@@ -18,7 +32,7 @@ $(document).ready(function() { ...@@ -18,7 +32,7 @@ $(document).ready(function() {
size = window.getComputedStyle(document.body,':after').getPropertyValue('content'); size = window.getComputedStyle(document.body,':after').getPropertyValue('content');
displayType = size; displayType = size;
if (size =='"mobile"') { if (isSizeMobile(size)) {
OnScreenResizeToMobile(); OnScreenResizeToMobile();
} }
...@@ -35,11 +49,11 @@ $(document).ready(function() { ...@@ -35,11 +49,11 @@ $(document).ready(function() {
// As long as display type did not change (is still equal to size property), // As long as display type did not change (is still equal to size property),
// then do not do screen resize logic. // then do not do screen resize logic.
if (displayType != size) { if (displayType != size) {
if (size == '"mobile"') { if (isSizeMobile(size)) {
OnScreenResizeToMobile(); OnScreenResizeToMobile();
displayType = size; displayType = size;
} else { } else {
if (size == '"widescreen"') { if (isSizeWidescreen(size)) {
OnScreenResizeToDesktop(); OnScreenResizeToDesktop();
displayType = size; displayType = size;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment