Skip to content

Commit 391b9d8

Browse files
author
幾米
committed
下拉固定背景不动
1 parent c58ec22 commit 391b9d8

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

‎box/chavy.boxjs.html‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
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+
}
1627
[v-cloak] {
1728
display: none;
1829
}
@@ -78,6 +89,7 @@
7889
</style>
7990
</head>
8091
<body>
92+
<div id="BG"></div>
8193
<div id="app" v-cloak>
8294
<v-app v-if="box" :style="appViewStyle">
8395
<v-snackbar top app v-model="ui.snackbar.show" v-bind="ui.snackbar">{{ui.snackbar.msg}}</v-snackbar>
@@ -1366,16 +1378,10 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
13661378
if (this.isWallpaper) {
13671379
const bodyStyle = [
13681380
`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'
1381+
`background-image: linear-gradient(rgba(0,0,0,.2) 1%, rgba(255,255,255,0) 10%), url(${this.box.usercfgs.bgimg})`
13761382
]
13771383
// document.querySelector('body').removeAttribute('style')
1378-
document.querySelector('body').setAttribute('style', bodyStyle.join('; '))
1384+
document.querySelector('#BG').setAttribute('style', bodyStyle.join('; '))
13791385
} else {
13801386
const darkBg = 'background-color: #121212'
13811387
const lightBg = 'background: linear-gradient(rgba(0,0,0,.3) 1%, rgba(255,255,255,0) 10%)'

0 commit comments

Comments
 (0)