🐛 Fixing a bug

This commit is contained in:
Wisp X
2021-12-27 22:36:54 +08:00
parent 8b584b54e4
commit 91a5f606df
3 changed files with 28 additions and 5 deletions

7
public/js/app.js vendored
View File

@@ -5466,6 +5466,13 @@ window.utils = {
return v.toString(16);
});
},
isMobile: function isMobile() {
if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)) {
return true;
}
return false;
},
infiniteScroll: function infiniteScroll(selector, options) {
if ($(selector).length > 0) {
var loadingText = options.loadingText || '加载中...';

19
resources/js/app.js vendored
View File

@@ -21,6 +21,19 @@ window.utils = {
return v.toString(16);
});
},
isMobile() {
if (navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
) {
return true;
}
return false;
},
infiniteScroll(selector, options) {
if ($(selector).length > 0) {
let loadingText = options.loadingText || '加载中...';
@@ -67,7 +80,7 @@ window.utils = {
};
let load = (params, force) => {
if (! force) {
if (!force) {
if (props.loading || props.finished) return;
}
if (typeof options.data === 'function') {
@@ -85,8 +98,8 @@ window.utils = {
load();
$(selector).off('click').on('click', 'span:not(.disabled)', () => load());
$(selector).scroll(function() {
if(this.scrollTop + $(selector).height() >= this.scrollHeight - offset) {
$(selector).scroll(function () {
if (this.scrollTop + $(selector).height() >= this.scrollHeight - offset) {
load();
}
});

View File

@@ -47,7 +47,7 @@
</x-dropdown>
</div>
</div>
<div class="relative inset-0 h-full">
<div class="relative inset-0 h-full overflow-hidden">
<!-- content -->
<div id="photos-scroll" class="absolute inset-0 overflow-y-scroll select-none">
<div id="photos-grid"></div>
@@ -65,7 +65,7 @@
<script type="text/html" id="photos-item-tpl">
<a href="javascript:void(0)" class="photos-item relative cursor-default rounded outline outline-2 outline-offset-2 outline-transparent">
<div class="photo-selector absolute z-[1] top-1 right-1 rounded-full overflow-hidden text-white text-lg bg-white border border-gray-500 cursor-pointer hidden group-hover:block">
<div class="photo-selector absolute z-[1] top-1 right-1 rounded-full overflow-hidden text-white text-lg bg-white border border-gray-500 cursor-pointer sm:hidden group-hover:block">
<i class="fas fa-check-circle block"></i>
</div>
<div class="photo-mask absolute left-0 right-0 bottom-0 h-20 z-[1] bg-gradient-to-t from-black" onclick="$(this).siblings('img').trigger('click')">
@@ -333,6 +333,9 @@
});
ds.subscribe('predragstart', ({ event }) => {
if (utils.isMobile()) {
ds.stop();
}
if (event.target.id !== 'photos-grid') {
ds.break();
}