FFIVE
2019-02-28 14:15:22
1.通過(guò)設(shè)置顏色 讓其網(wǎng)站上顯示不同的背景色【就是一個(gè)賬號(hào)設(shè)置了一些樣式 使其在另一個(gè)地方展示所設(shè)置的內(nèi)容】 問(wèn)題就是這樣樣式如何設(shè)置 讓其在修改的時(shí)候簡(jiǎn)單一些2.我在網(wǎng)上看了下css in js是一個(gè)不錯(cuò)的方法 但是我看都是基于框架的例如react 我的網(wǎng)站層內(nèi)容需要兼容到較低的版本
1 回答

嚕嚕噠
TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超7個(gè)贊
using dynamic sub class in the html and js code, give you an example in angular.js:
in html:
<div ng-class = getDivClass(userSetting)></div>
in Controller:
$scope.getDivClass = function(userSetting){
if(userSetting){
return "blue";
}
}
in css :
.blue{
background-color: blue;
}
The above method is implemented by angular.js. if you want to use jquery or something else, the mechanism is similar.
添加回答
舉報(bào)
0/150
提交
取消