mirror of
https://git.ddmt.top/ddmt/ddmt-tool.git
synced 2026-03-23 05:17:06 +00:00
1.0.8
This commit is contained in:
@@ -21,3 +21,21 @@ export function animateStart(HTMLElement, className, forceExecute=false) {
|
||||
event.target.classList.remove(className); // 清洗动画
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置CSS变量值
|
||||
* @param {string} varName
|
||||
* @param {string} value
|
||||
*/
|
||||
export function setClassVar(varName, value) {
|
||||
document.documentElement.style.setProperty(varName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取CSS变量值
|
||||
* @param {string} varName
|
||||
* @returns
|
||||
*/
|
||||
export function getStyleVar(varName) {
|
||||
return getComputedStyle(document.documentElement).getPropertyValue(varName);
|
||||
}
|
||||
Reference in New Issue
Block a user