Home > front end >  Help leaders by js change topics background, requirement as follows
Help leaders by js change topics background, requirement as follows

Time:10-16

1 page refresh when the default display a theme
2 users click on theme change button, display theme selection page
If user opens the page of the theme selection, click ok after the selected topic background, will change topic background, and the hidden theme selection panel
After 4 user opens the selection interface, if choose click cancel, must not do any changes to the background of the subject matter and the hidden theme selection panel

CodePudding user response:

 
<body>
















<style>
The theme - the list {
display: none;
}
</style>
<script>
Let themeEl=document. GetElementById (' themes')
Let themeV=document. ThemeForm. Theme
If (localStorage. Theme) {
ThemeV. Value=https://bbs.csdn.net/topics/localStorage.theme
SetTheme (' init ')
}
The function Theme () {
If (themeEl. Style. The display=='none' | |! ThemeEl. Style. The display) {
ThemeEl. Style. The display='block'
} else {
ThemeEl. Style. The display='none'
}
}
The function setTheme (type) {
Document. Body. Style. Background=themeV. Value
LocalStorage. Theme=themeV. Value
if (! Type) {
The Theme ()
}
}
</script>

Background image you want to change can change value using the class name of the radio and style with the background configuration inside background
Prev:vue
Next:Vue UI
  • Related