如何为两种用户更改网页的字体和背景颜色



我正在尝试集成模板。我有客户的要求:

用户空间将具有蓝色背景。

专业用户空间将具有橙色背景。

如何应用条件,以便可以更改背景的每种颜色,具体取决于用户是普通用户(蓝色(或专业用户(橙色(。

您可以在URL中添加一个查询字符串,并为每个特定的USERTYPE加载Stylesheet所需的样式表:

登录,并且用户获取这些URL

webling.com?view =专业

webling.com?view = regular

if (window.location.search.indexOf('?view=professional') === 0)
  document.write('<link rel="stylesheet" href="professionalStylesheet.css" />');
else
  document.write('<link rel="stylesheet" href="regularStylesheet.css" />');

定义CSS中的两个类,然后在JavaScript中使用classList.toggle('classname')为每个用户切换

最新更新