跑马灯可以实现播放和暂停以及调速

跑马灯可以实现播放和暂停以及调速

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<link
      rel="stylesheet"
      href="swiper/swiper-bundle.min.css"
    />
		<title></title>
	</head>
	<link rel="stylesheet" href="css/liMarquee.css">
	<style type="text/css">
		body {
        background: #eee;
        font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
        font-size: 14px;
        color: #000;
        margin: 0;
        padding: 0;
      }

		#stopan,#start{
			width: 100px;
			height: 50px;
			position: fixed;
			left: 50px;
			top: 100px;
			z-index: 2020;
		}
		#start{
			left: 150px;
		}
		.str_div{
			position:absolute;
			width:100px;
			height:100px;
			z-indent:2;
			left:100px;
			top:100px;
			color:yellow;
			font-size: 25px
		}

	</style>
	<body>
		<button type="button" id="stopan">点击停止动画</button>
		<button type="button" id="start">点击开始动画</button>	
		<div class="str4 str_wrap">
			<a href="#" >
				<img src="src/img/use/1.png">
				<div class ="str_div">1</div>				
			</a>

			<a href="#">
				<img src="src/img/use/2.png">
				<div class ="str_div">2</div>
			</a>
			<a href="#">
				<img src="src/img/use/3.png">
				<div class ="str_div">3</div>
			</a>
			<a href="#">
				<img src="src/img/use/4.png">
				<div class ="str_div">4</div>
			</a>
			<a href="#">
				<img src="src/img/use/5.png">
				<div class ="str_div">5</div>
			</a>
			<a href="#">
				<img src="src/img/use/6.png">
				<div class ="str_div">6</div>
			</a>
			<a href="#">
				<img src="src/img/use/7.png">
				<div class ="str_div">7</div>
			</a>
			<a href="#">
				<img src="src/img/use/8.png">
				<div class ="str_div">8</div>
			</a>
			<a href="#">
				<img src="src/img/use/9.png">
				<div class ="str_div">9</div>
			</a>
			<a href="#">
				<img src="src/img/use/10.png">
				<div class ="str_div">10</div>
			</a>
			<a href="#">
				<img src="src/img/use/11.png">
				<div class ="str_div">11</div>
			</a>
			<a href="#">
				<img src="src/img/use/12.png">
				<div class ="str_div">12</div>
			</a>
			<a href="#">
				<img src="src/img/use/13.png">
				<div class ="str_div">13</div>
			</a>
			<a href="#">
				<img src="src/img/use/14.png">
				<div class ="str_div">14</div>
			</a>
			<a href="#">
				<img src="src/img/use/15.png">
				<div class ="str_div">15</div>
			</a>
			<a href="#">
				<img src="src/img/use/16.png">
				<div class ="str_div">16</div>
			</a>
			<a href="#">
				<img src="src/img/use/17.png">
				<div class ="str_div">17</div>
			</a>
			<a href="#">
				<img src="src/img/use/18.png">
				<div class ="str_div">18</div>
			</a>
			<a href="#">
				<img src="src/img/use/19.png">
				<div class ="str_div">19</div>
			</a>
			<a href="#">
				<img src="src/img/use/20.png">
				<div class ="str_div">20</div>
			</a>
		</div>


    </div>
	</body>
	<script src="js/jquery-1.8.3.min.js"></script>
	<script src="js/jquery.liMarquee.js"></script>
	<script type="text/javascript">
		$('#stopan').on('click',()=>{
			$dowebok.liMarquee('pause')
		})
		$('#start').on('click',()=>{
			$dowebok.liMarquee('play')
		})
		
		$dowebok = $('.str4').liMarquee({
            //默认没有参数 是向左滚动
            direction: 'left',
            // direction: 'right',
            // direction: 'up',
            // direction: 'down',
            //滚动速度
            scrollamount: 2000,
            //非无缝滚动
            circular: true,
            //禁止拖动
            // drag: false,
            //内容不足不滚动
            // runshort: false,
            //鼠标悬停不暂停
            hoverstop: false,
            //反向
            // inverthover: true
        }) 

	$dowebok.liMarquee('pause');


        // 事件
        // $(document).on('click', function () {
        //     // 暂停
        //     // $dowebok.liMarquee('pause');
        //     // 播放
        //     // $dowebok.liMarquee('play');
        //     // 销毁
        //     // $dowebok.liMarquee('destroy');
        //     // 更新
        //     // $dowebok.liMarquee('update');
        // });

	</script>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值