mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
add artplayer-tool-thumbnail demo
This commit is contained in:
1 parent
64c21d04bd
commit
af12acba9d
5 files changed
+153
-31
No files matched your search
@@ -39,10 +39,23 @@ class ArtplayerToolThumbnail extends Emitter {
|
||||
this.option = Object.assign({}, this.option, option);
|
||||
const { fileInput, delay, number, width, height, column } = this.option;
|
||||
|
||||
this.errorHandle(
|
||||
fileInput.tagName === 'INPUT' && fileInput.type === 'file',
|
||||
'The \'fileInput\' is not a usable file input like: <input type="file">',
|
||||
);
|
||||
this.errorHandle(fileInput instanceof Element, "The 'fileInput' is not a Element");
|
||||
|
||||
if (!(fileInput.tagName === 'INPUT' && fileInput.type === 'file')) {
|
||||
fileInput.style.position = 'relative';
|
||||
const newFileInput = document.createElement('input');
|
||||
newFileInput.type = 'file';
|
||||
newFileInput.style.position = 'absolute';
|
||||
newFileInput.style.width = '100%';
|
||||
newFileInput.style.height = '100%';
|
||||
newFileInput.style.left = '0';
|
||||
newFileInput.style.top = '0';
|
||||
newFileInput.style.right = '0';
|
||||
newFileInput.style.bottom = '0';
|
||||
newFileInput.style.opacity = '0';
|
||||
fileInput.appendChild(newFileInput);
|
||||
this.option.fileInput = newFileInput;
|
||||
}
|
||||
|
||||
['delay', 'number', 'width', 'height', 'column'].forEach(item => {
|
||||
this.errorHandle(typeof this.option[item] === 'number', `The '${item}' is not a number`);
|
||||
|
||||
Reference in new issue
Block a user