Skip to content
Permalink
Browse files

Use window.innerWidth to detect mobile devices.

Although window.orientation works well to detect mobile devices for now, it is deprecated and might be unreliable.
See also: https://developer.mozilla.org/en-US/docs/Web/API/Window/orientation

Using the viewport size is also a better approach for hiding/showing additional view elements.
  • Loading branch information...
blueimp committed Apr 19, 2019
1 parent 818f976 commit d1f2707591a9be581948be32f3c2639879e1f498
Showing with 4 additions and 4 deletions.
  1. +2 −2 index.html
  2. +2 −2 jquery-ui.html
@@ -149,7 +149,7 @@ <h3 class="title"></h3>
<span class="preview"></span>
</td>
<td>
{% if (window.orientation === undefined || !o.options.loadImageFileTypes.test(file.type)) { %}
{% if (window.innerWidth > 480 || !o.options.loadImageFileTypes.test(file.type)) { %}
<p class="name">{%=file.name%}</p>
{% } %}
<strong class="error text-danger"></strong>
@@ -187,7 +187,7 @@ <h3 class="title"></h3>
</span>
</td>
<td>
{% if (window.orientation === undefined || !file.thumbnailUrl) { %}
{% if (window.innerWidth > 480 || !file.thumbnailUrl) { %}
<p class="name">
{% if (file.url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
@@ -154,7 +154,7 @@ <h3 class="title"></h3>
<span class="preview"></span>
</td>
<td>
{% if (window.orientation === undefined || !o.options.loadImageFileTypes.test(file.type)) { %}
{% if (window.innerWidth > 480 || !o.options.loadImageFileTypes.test(file.type)) { %}
<p class="name">{%=file.name%}</p>
{% } %}
<strong class="error"></strong>
@@ -186,7 +186,7 @@ <h3 class="title"></h3>
</span>
</td>
<td>
{% if (window.orientation === undefined || !file.thumbnailUrl) { %}
{% if (window.innerWidth > 480 || !file.thumbnailUrl) { %}
<p class="name">
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
</p>

0 comments on commit d1f2707

Please sign in to comment.
You can’t perform that action at this time.