之前写过个插件,给 Typecho 和 WordPress 加上雷姆和拉姆的 gif 动图,核心源码如下
html代码:
<div class="remram">
<div class="rem"></div>
<div class="ram"></div>
</div>
css代码:
.remram {
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
display: flex;
position: fixed;
justify-content: space-between;
}
/*高分辨率下加载图片素材*/
@media (min-width: 1420px){
.remram div {
background-repeat:no-repeat;
background-size: 250px;
background-image: url('./remram.gif') !important;
width: 125px;
}
.remram .rem{
background-position: -125px bottom;
}
.remram .ram{
background-position: 0 bottom;
}
}
图片素材:
因为 xLog 目前只能自定义css,没法插入自定义div
块,所以只能曲线救国,然后发现xLog结构里面有个<div id="site-aplayer"></div>
应该是准备给音乐播放器用的,但目前好像还没啥用,所以可以针对它进行一些骚操作,经过提醒发现直接加到.xlog-page
上就行,优化了下写法,需要加的css还减少了几行。
自定义css如下:
/*高分辨率下加载图片素材*/
@media (min-width: 1280px){
.xlog-page::before, .xlog-page::after {
position: fixed;
top: 0;
bottom: 0;
content: ' ';
background-repeat: no-repeat;
background-size: 250px;
background-image: url(https://xlog.app/cdn-cgi/image/width=1080,quality=75,format=auto,onerror=redirect/https://ipfs.xlog.app/ipfs/bafybeieoif32ybcbt22enk4ikytzvu4oxudlc27egg3j3t5mqgg2f6cs5i) !important;
width: 125px;
background-position: -125px bottom;
}
.xlog-page::after {
background-position: 0 bottom;
right: 0;
}
}