js 实现iFonts书签动画

具体网址效果

https://ifonts.com/clientdown?from=360fontDownload&fk=766471

 html

<div class="box">
	<div class="box1">
		<ul>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card1.jpg" alt="">
			</li>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card2.jpg" alt="">
			</li>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card3.jpg" alt="">
			</li>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card4.jpg" alt="">
			</li>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card5.jpg" alt="">
			</li>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card6.jpg" alt="">
			</li>
			<li class="lis">
				<i></i>
				<img src="https://pic.51ifonts.com/images/client-index/card7.jpg" alt="">
			</li>
		</ul>
	</div>
	<!-- box -->
</div>

css

<style>
	.box {
		width: 100%;
		background-color: #ccc;
		height: 50vh;
	}

	.box1 {
		width: 1110px;
		margin: 0 auto;
	}

	.box1:after {
		content: "";
		display: block;
		clear: both;
	}

	.box1 ul li {
		list-style: none;
		float: left;
		margin-right: 42px;
		width: 84px;
		height: 228px;
		background: #fff;
		border: 1px solid #d9ddea;
		box-shadow: 0 1px 5px 0 rgb(217 221 234 / 56%);
		border-radius: 42px;
		padding-top: 36px;
		text-align: center;
		transform-origin: 42px 36px;
		/*旋转中心点*/
	}

	.box1 ul li:last-child {
		margin-right: 0;
	}

	.box1 ul li i {
		display: block;
		margin: 0px auto 24px;
		width: 10px;
		height: 10px;
		border-radius: 50%;
		border: 1px solid #ccd0dc;
		background: #f4f6f9;
	}

	.box1 ul li img {
		width: 30px;
	}

	.begin {
		animation: sky 2s linear alternate;
	}


	@keyframes sky {
		0% {
			transform: rotate(15deg);
		}

		20% {
			transform: rotate(-15deg);
		}

		50% {
			transform: rotate(8deg);
		}

		70% {
			transform: rotate(-8deg);
		}

		90% {
			transform: rotate(3deg);
		}

		100% {
			transform: rotate(0deg);
		}
	}
</style>

script

<script>
	let lis = document.getElementsByClassName("lis");
	for (let val of lis) {
		val.onmouseover = function start() {
			this.className = 'begin';
		};
		val.onmouseout = function stop() {
			setTimeout(() => {
				this.className = '';
			}, 2000)
		}
	}
</script>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值