php打赏功能,用JS实现简易打赏功能

编程入门 行业动态 更新时间:2024-10-26 02:24:49

php打赏<a href=https://www.elefans.com/category/jswz/34/1771378.html style=功能,用JS实现简易打赏功能"/>

php打赏功能,用JS实现简易打赏功能

这次给大家带来用JS实现简易打赏功能,用JS实现简易打赏功能的注意事项有哪些,下面就是实战案例,一起来看一下。

打赏

#dsSidebar {

z-index: 999999;

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').οnlοad=function() {

vardsSidebar=document.getElementById('dsSidebar');

dsSidebar.οnmοuseοver=function() {

startMove(0, 24);

}

dsSidebar.οnmοuseοut=function() {

startMove(-200, -24);

}

moveBtn();

}

喜欢请用微信打赏


更多推荐

php打赏功能,用JS实现简易打赏功能

本文发布于:2024-03-23 22:00:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1743326.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:功能   简易   php   JS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!