
1、引入drag.js和Jquery库文件:
<script src="./js/jquery-1.12.3.js"></script> <script src="./js/drag.js"></script>
2、引入css文件:
<link rel="stylesheet" href="./css/drag.css">
<style type="text/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}
    }
</style>3、编写html:
<div id="wrapper" style="position:relative; top:300px; left:300px;"> <div id="drag"> <div class="drag_bg"></div> <div class="drag_text slidetounlock" onselectstart="return false;" unselectable="on"> 请按住滑块,拖动到最右边 </div> <!-- 默认值0 没有验证通过 --> <input type="hidden" name="name" value="0"> <div class="handler handler_bg"></div> </div> </div>
4、调用JS:
<script>
    $('#drag').drag();
</script>转载请注明来源地址:小川编程 » https://www.youhutong.com/index.php/article/index/209.html
1、本站发布的内容仅限用于学习和研究目的.请勿用于商业或非法用途,下载后请24小时内删除。
2、本站所有内容均不能保证其完整性,不能接受请勿购买或下载,如需完整程序,请去其官方购买正版使用
3、本站联系方式Email:admin@youhutong.com ,收到邮件会第一时间处理。
4、如侵犯到任何版权问题,请立即告知本站(立即在线告知),本站将及时删除并致以最深的歉意
 
				 
		




