mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-24 23:51:20 -08:00
优化移动端UI
This commit is contained in:
1 parent
beea013daf
commit
7b3913e318
13 files changed
+96
-55
No files matched your search
@@ -1,9 +1,4 @@
|
||||
export const userAgent = window.navigator.userAgent;
|
||||
|
||||
export function isMobile() {
|
||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
||||
}
|
||||
|
||||
export function isSafari() {
|
||||
return /^((?!chrome|android).)*safari/i.test(userAgent);
|
||||
}
|
||||
export const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
||||
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
|
||||
export const isWechat = /MicroMessenger/i.test(userAgent);
|
||||
@@ -1,3 +1,5 @@
|
||||
import { isMobile } from './compatibility';
|
||||
|
||||
export function query(selector, parent = document) {
|
||||
return parent.querySelector(selector);
|
||||
}
|
||||
@@ -37,7 +39,7 @@ export function setStyle(element, key, value) {
|
||||
}
|
||||
|
||||
export function setStyles(element, styles) {
|
||||
Object.keys(styles).forEach(key => {
|
||||
Object.keys(styles).forEach((key) => {
|
||||
setStyle(element, key, styles[key]);
|
||||
});
|
||||
return element;
|
||||
@@ -49,15 +51,16 @@ export function getStyle(element, key, numberType = true) {
|
||||
}
|
||||
|
||||
export function sublings(target) {
|
||||
return Array.from(target.parentElement.children).filter(item => item !== target);
|
||||
return Array.from(target.parentElement.children).filter((item) => item !== target);
|
||||
}
|
||||
|
||||
export function inverseClass(target, className) {
|
||||
sublings(target).forEach(item => removeClass(item, className));
|
||||
sublings(target).forEach((item) => removeClass(item, className));
|
||||
addClass(target, className);
|
||||
}
|
||||
|
||||
export function tooltip(target, msg, pos = 'up') {
|
||||
if (isMobile) return;
|
||||
target.setAttribute('aria-label', msg);
|
||||
target.setAttribute('data-balloon-pos', pos);
|
||||
}
|
||||
Reference in new issue
Block a user