*新闻详情页*/>
序言
近期在工作中中遇到1个要求,完成的实际效果是当点一下产品照片右上的个人收藏按钮开启变大动漫,后来根据搜索有关的材料,发现运用css3:@keyframes animation便可完成这个实际效果,下面看来看详尽的详细介绍吧。
技术性关键css3: @keyframes animation
示例编码
<!DOCTYPE html> <head> <style type="text/css"> @keyframes myfirst { 0% { width: 50px; height: 50px; top: 10px; right: 10px; } 75% { width: 60px; height: 60px; top: 5px; right: 5px; } 100% { width: 50px; height: 50px; top: 10px; right: 10px; } } .warp { width: 400px; height: 300px; position: relative; background: #ccc; } .btn { position: absolute; width: 50px; height: 50px; border:solid 3px #cc3c24; top: 10px; right: 10px; border-radius: 8px; cursor: pointer; } .btn.cur{ animation: myfirst 0.2s; } .btn.yes{ background: #cc3c24; } </style> </head> <body> <div class="warp"> <div class="btn"></div> </div> <script src="http://liuxiaofan.com/demo/js/jquery⑵.1.4.min.js"></script> <script> var btn = $('.btn'); btn.click(function () { if( $(this).is('.yes')){ $(this).removeClass('yes'); $(this).removeClass('cur'); }else{ $(this).addClass('yes'); $(this).addClass('cur'); } }); btn.on('webkitAnimationEnd', function () { $(this).removeClass('cur'); }); </script> </body> </html>
实际效果图以下:
总结
以上便是这篇文章内容的所有內容了,期待本文的內容对大伙儿的学习培训或工作中能带来1定的协助,假如有疑惑大伙儿能够留言沟通交流,感谢大伙儿对脚本制作之家的适用。
Copyright © 2002-2020 h5互动游戏_微信h5怎么制作_h5转盘抽奖_h5测试制作_凡科H5 版权所有 (网站地图) 粤ICP备10235580号