弘帝企业智能建站系统交流平台

 找回密码
 立即注册
查看: 2332|回复: 0

加入购物车抛物线动画示范脚本

[复制链接]
发表于 2016-9-3 23:00:46 | 显示全部楼层 |阅读模式
模板案例(1yyg)

DIV:
加入购物车按纽(抛物线起点):
<span class="addcart">加入购物车</span>
购物车盒子列表(抛物线终点):
<div class="sidebar">
<div class="cart">
<i id="end"><em></em></i>
<span>购物车</span>
</div>
</div>

CSS:
.flyer,#end{ display:inline-block; width:20px; height:20px; font-size:0; background:url(2016.png) no-repeat 0 -400px;}
.sidebar{ position: fixed; top: 0; right: 0; background: #000; width: 35px; height: 100%; font-size: 12px; color: #fff; text-align:center; background:url(sentence.gif) #5c5550 no-repeat;}
.sidebar .cart{line-height:22px; width:20px; font-size:14px; font-weight:bold; margin:0 auto; margin-top:300px;}

JS:
<script type="text/javascript" src="SysThemes/js/jquery.js"></script>
<script type="text/javascript" src="systhemes/js/jquery.fly.js"></script>
jQuery(window).ready(function(e){
        jQuery('.addcart').on('click',AddCart);
})
function AddCart(event){
        var pos = $('#end').position(), offset=$('#end').offset(), flyer = $('<div class="flyer"></div>');
        flyer.fly({ start:{ left: event.clientX, top: event.clientY }, end:{ left: offset.left, top: pos.top, width: 20, height: 20 },onEnd: function(){ cart(); this.destory();/*销毁抛物体*/}});
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|弘帝企业智能建站系统 ( 皖ICP备07503252号 )

GMT+8, 2024-4-20 03:10 , Processed in 0.055794 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表