HTML and CSS#
Previously wrote a plugin to add Rem and Ram gif animations to Typecho and WordPress, the core source code is as follows:
HTML code:
<div class="remram">
<div class="rem"></div>
<div class="ram"></div>
</div>
CSS code:
.remram {
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
display: flex;
position: fixed;
justify-content: space-between;
}
/* Load image material for high resolution */
@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;
}
}
Image material:
Add Rem and Ram to xLog#
Because xLog currently only allows custom CSS and cannot insert custom div
blocks, we can only find a workaround. I found a <div id="site-aplayer"></div>
in the xLog structure, which seems to be prepared for a music player, but it doesn't seem to be used yet. So we can do some tricks with it. After being reminded, I found that adding it directly to .xlog-page
is enough. I optimized the code and reduced the amount of CSS needed.
Custom CSS code:
/* Load image material for high resolution */
@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;
}
}