给你的博客加上喵喵,废话不多说,咱们直接上代码。
代码
这段放到footer.php中即可。
<div id="maomao" onmouseout="duoMaomao()"></div>
<script>
var duoMaomao = function() {
var maomao = $('#maomao');
maomao.css('bottom', randomNum(5, 80) + 'vh');
}</script>
css
<style>
#maomao {position: fixed; bottom: 40px; right: -5px; width: 57px; height: 70px; background-image: url(https://siitake.cn/src/mao.svg); background-position: center; background-size: cover; background-repeat: no-repeat; transition: background .3s;}
#maomao:hover {background-position: 60px 50%;}
@media screen and (max-width: 1199px) {
.main { margin-left: 200px; }
.l-item { width: calc(25% - 40px); }
}
@media screen and (max-width: 991px) {
.main { margin-left: 150px; }
.l-item { width: calc(33.33% - 40px); }
}
@media screen and (max-width: 767px) {
.main { margin-left: 100px; }
.l-item { width: calc(50% - 40px); }
}
@media screen and (max-width: 512px) {
.main { margin-left: 50px; }
.l-item { width: calc(100% - 40px); }
}
</style>