Skip to content

Commit 87ac7ce

Browse files
authored
Merge pull request chavyleung#217 from id77/master
下拉固定背景不动
2 parents c58ec22 + eaca58b commit 87ac7ce

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

‎box/chavy.boxjs.html‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@
1313
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet" />
1414
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet" />
1515
<style>
16+
#BG {
17+
position: fixed;
18+
top: 0;
19+
left: 0;
20+
bottom: 0;
21+
right: 0;
22+
z-index: 0;
23+
background-position: center;
24+
background-size: cover;
25+
background-repeat: no-repeat;
26+
background-color: transparent;
27+
}
1628
[v-cloak] {
1729
display: none;
1830
}
@@ -78,6 +90,7 @@
7890
</style>
7991
</head>
8092
<body>
93+
<div id="BG"></div>
8194
<div id="app" v-cloak>
8295
<v-app v-if="box" :style="appViewStyle">
8396
<v-snackbar top app v-model="ui.snackbar.show" v-bind="ui.snackbar">{{ui.snackbar.msg}}</v-snackbar>
@@ -1366,16 +1379,10 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
13661379
if (this.isWallpaper) {
13671380
const bodyStyle = [
13681381
`background-color: ${this.isDarkMode ? '#121212' : '#fff'}`,
1369-
`background-image: linear-gradient(rgba(0,0,0,.2) 1%, rgba(255,255,255,0) 10%), url(${this.box.usercfgs.bgimg})`,
1370-
'background-position: center',
1371-
'background-size: cover',
1372-
'background-repeat: no-repeat',
1373-
'background-attachment: scroll',
1374-
'height: 100vh',
1375-
'overflow-y: scroll'
1382+
`background-image: linear-gradient(rgba(0,0,0,.2) 1%, rgba(255,255,255,0) 10%), url(${this.box.usercfgs.bgimg})`
13761383
]
13771384
// document.querySelector('body').removeAttribute('style')
1378-
document.querySelector('body').setAttribute('style', bodyStyle.join('; '))
1385+
document.querySelector('#BG').setAttribute('style', bodyStyle.join('; '))
13791386
} else {
13801387
const darkBg = 'background-color: #121212'
13811388
const lightBg = 'background: linear-gradient(rgba(0,0,0,.3) 1%, rgba(255,255,255,0) 10%)'

0 commit comments

Comments
 (0)