“Widget:Bgimage”的版本间差异
小 (// Edit via Wikiplus) |
(//使用页面/文本对比查看器快速编辑) |
||
(未显示同一用户的20个中间版本) | |||
第1行: | 第1行: | ||
<noinclude>{{doc|content=请使用{{tl|背景图片}}调用。 |
<noinclude>{{doc|content=用于在桌面版添加背景图片,请使用{{tl|背景图片}}调用。 |
||
//</includeonly>Javascript脚本:<pre lang=js> |
|||
==外部链接== |
|||
window.addEventListener('load', function () { |
|||
{{CCnotice|MGP=widget:sideBarPic}}}}[[category:混合小部件]] |
|||
var ele = document.querySelector('.bgimage'); |
|||
<p>JavaScript脚本:[[User:Bhsd/widget/bgimage.js]]</p></noinclude><includeonly><!--{if !isset($wgBgimage) || !$wgBgimage}--><!--{assign var="wgBgimage" value=true scope="global"}--><script defer src="/zh?title=user:bhsd/widget/bgimage.js&action=raw&ctype=text/javascript"></script><style> |
|||
var url = ele.dataset.url; |
|||
if (url.match(/llwiki\.org/)) { |
|||
var img = document.createElement('img'); |
|||
img.src = url; |
|||
ele.appendChild(img); |
|||
ele.style.opacity = ele.dataset.opacity; |
|||
document.querySelector("#mw-navigation").appendChild(ele); |
|||
} |
|||
if (ele.dataset.logo == 'off') { |
|||
document.querySelector('#p-logo').style.visibility = 'hidden'; |
|||
} |
|||
}); |
|||
//</pre> |
|||
// <includeonly> |
|||
</script> |
|||
<style> |
|||
/* </includeonly>CSS样式表:<pre lang="css"> */ |
/* </includeonly>CSS样式表:<pre lang="css"> */ |
||
.bgimage { |
.bgimage { |
||
display: none; |
|||
position: fixed; |
position: fixed; |
||
left: 0; |
left: 0; |
||
第27行: | 第13行: | ||
} |
} |
||
.bgimage img { |
.bgimage img { |
||
width: |
width: 100vw; |
||
height: |
height: 100vh; |
||
object-fit: cover; |
|||
} |
} |
||
/* </pre><includeonly> */ |
/* </pre><includeonly> */ |
||
</style> |
</style><!--{/if}--></includeonly> |
||
<!--{/if}--></includeonly> |
2022年5月17日 (二) 19:50的最新版本
小部件文档
这个文档是内联文档。
用于在桌面版添加背景图片,请使用{{背景图片}}调用。
外部链接
本页面含有来自萌娘百科的文本,以CC BY-NC-SA 3.0授权引入。经过双方的修改,内容可能已与来源有很大差异。
JavaScript脚本:User:Bhsd/widget/bgimage.js
CSS样式表:
*/
.bgimage {
display: none;
position: fixed;
left: 0;
top: 0;
z-index: -2;
}
.bgimage img {
width: 100vw;
height: 100vh;
object-fit: cover;
}
/*