Flask接口签名sign原理与实例代码浅析
231
2023-04-10
自制简易打赏功能的实例
1、申请开通cnblogs的js代码支持
2、将微信收款码图片上传到cnblogs
3、将如下代码中的http://files.cnblogs.com/files/eritpang/weixin.bmp替换为刚刚上传的收款码图片的链接地址,然后将代码添加到设置->博客侧边栏公告(支持HTML代码)(支持JS代码)里面,再点击“保存”即可。
#dsSidebar {
z-index: 999999;
RcozyeWl top: 18%;
width: 200px;
height: 200px;
position: fixed;
right: -200px;
}
#dsBtn {
z-index: 999999;
width: 30px;
height: 58px;
left: -30px;
top: 80px;
line-height: 28px;
position: absolute;
}
.dsPanels {
margin: 0px auto;
overflow: hidden;
}
.dsPanel {
float: left;
margin: 0px 0px;
padding: 12px 0px;
text-align: center;
background: #ffeedd;
border-color: #ffeedd;
border-radius: 8px;
}
.dsPanel-highlight {
margin-top: 0;
margin-bottom: 0;
padding-left: 10px;
padding-right: 10px;
width: 160px;
border: 8px solid #fd935c;
}
.dsPanel-button {
display: block;
font-size: 16px;
font-weight: 500;
color: #ffeedd;
text-align: center;
text-decoration: none;
text-shadow: 0 1px rgba(black, .1);
background: #fd935c;
border-bottom: 2px solid #cf7e3b;
border-color: rgba(black, .15);
border-radius: 4px;
}
.dsPanel-title {
width: 128px;
margin: -15px auto 15px;
padding-bottom: 0px;
line-height: 22px;
font-size: 14px;
font-weight: bold;
color: #ffeedd;
text-shadow: 0 1px rgba(black, .05);
background: #fd935c;
border-radius: 0 0 4px 4px;
}
function moveBtn() {
var dsBtn = document.getElementById("dsBtn");
var now = new Date();
var times = now.getTime();
var offsetSize = Math.sin(times / 380.0) * 15 + 45;
var radius = Math.sin(times / 380.0) * 18 + 24;
dsBtn.style.left = -offsetSize + 'px';
dsBtn.style.width = offsetSize + 'px';
dsBtn.style.borderRadius = radius + 'px';
setTimeout(moveBtn, 60);
}
var dsSidebarTimer = null;
var dsSidebarOffsetRight = -200;
function startMove(dsSidebarTarget, dsSidebarSpeed) {
clearTimeout(dsSidebarTimer);
function doMove() {
var dsSidebar = document.getElementById('dsSidebar');
dsSidebarSpeed *= 0.9;
if (dsSidebarSpeed > -1 && dsSidebarSpeed < 0) {
dsSidebarSpeed = -1;
} else if (dsSidebarSpeed < 1 && dsSidebarSpeed > 0) {
dsSidebarSpeed = 1;
}
dsSidebarOffsetRight = dsSidebarOffsetRight + dsSidebarSpeed;
if (dsSidebarSpeed > 0 && dsSidebarOffsetRight >= dsSidebarTarget) {
dsSidebarOffsetRight = dsSidebarTarget;
dsSidebar.style.right = dsSidebarOffsetRight + 'px';
} else if (dsSidebarSpeed < 0 && dsSidebarOffsetRight <= dsSidebarTarget) {
dsSidebarOffsetRight = dsSidebarTarget;
dsSidebar.style.right = dsSidebarOffsetRight + 'px';
} else {
dsSidebar.style.right = dsSidebarOffsetRight + 'px';
dsSidebarTimer = setTimeout(doMove, 30);
}
}
doMove();
}
document.getElementById('dsImg').onload = function () {
var dsSidebar = document.getElementById('dsSidebar');
dsSidebar.onmouseover = function () {
startMove(0, 24);
}
dsSidebar.onmouseout = function () {
startMove(-200, -24);
}
moveBtn();
}
喜欢请用微信打赏
</html>
4、效果如下。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~