前端实现拖动滑块完成验证

index.html

 
请按住滑块,拖动到最右边

index.css

.slidetounlock {
    font-size: 12px;
    background: -webkit-gradient(linear,left top,right top,color-stop(0,#4d4d4d),color-stop(.4,#4d4d4d),color-stop(.5,#fff),color-stop(.6,#4d4d4d),color-stop(1,#4d4d4d));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-animation: slidetounlock 3s infinite;
    -webkit-text-size-adjust: none
}

@-webkit-keyframes slidetounlock {
    0% {
        background-position: -200px 0
    }
    100% {
        background-position: 200px 0
    }
}
#drag{
    position: relative;
    background-color: #e8e8e8;
    width: 300px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    margin-bottom:20px;
}
#drag .handler{
    position: absolute;
    top: 0px;
    left: 0px;
    width: 40px;
    height: 38px;
    border: 1px solid #ccc;
    cursor: move;
}
.handler_bg{
    background: #fff url("../img/slider.png") no-repeat center;
}
.handler_ok_bg{
    background: #fff url("../img/complet.png") no-repeat center;
}
#drag .drag_bg {
    /*background-color: #7ac23c;*/
    background: #8dcefb;
    height: 40px;
    width: 0px;
}
#drag .drag_text{
    position: absolute;
    top: 0px;
    width: 300px;
    color:#9c9c9c;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    -o-user-select:none;
    -ms-user-select:none;
    font-size: 12px;  
}

index.js


 

你可能感兴趣的:(web)