Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 15ed30d

Browse files
committed
[CHG]支持通过百分比控制视频宽高
1 parent 6b1b596 commit 15ed30d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

demos/base-demo/ezuikit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,16 @@
269269

270270
if (params.height) {
271271
iframeHeight = parseInt(params.height);
272+
if(/\%$/.test(params.height)) {
273+
iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.height) /100);
274+
}
272275
}
273276

274277
if (params.width) {
275278
iframeWidth = parseInt(params.width);
279+
if(/\%$/.test(params.width)) {
280+
iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.width) /100);
281+
}
276282
}
277283

278284
iframe.width = iframeWidth;

ezuikit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,16 @@
269269

270270
if (params.height) {
271271
iframeHeight = parseInt(params.height);
272+
if(/\%$/.test(params.height)) {
273+
iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.height) /100);
274+
}
272275
}
273276

274277
if (params.width) {
275278
iframeWidth = parseInt(params.width);
279+
if(/\%$/.test(params.width)) {
280+
iframeWidth = document.getElementById(id).offsetWidth * (parseInt(params.width) /100);
281+
}
276282
}
277283

278284
iframe.width = iframeWidth;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ezuikit-js",
3-
"version": "0.2.8",
3+
"version": "0.2.9",
44
"description": "ezuikit javascript for npm",
55
"main": "ezuikit.js",
66
"scripts": {

0 commit comments

Comments
 (0)