javascript - 求一个加入购物车的效果
黄舟
黄舟 2017-04-11 11:04:34
[JavaScript讨论组]


类似这样的购物车,点击加号,物品会有个抛物线掉进去购物车,购物车的数量会增加

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回复(4)
怪我咯

抛物线加入购物车,Github:https://github.com/bigmeow/fly

应用示例:https://bigmeow.cn/demo/maicai

PHPz

好吧;给你发个示例吧:链接:http://share.weiyun.com/ba26ce707b5342d7d6e0d49e9dbfac0f (密码:w20W)

PHP中文网

不是这样的效果类似这样的http://xianfengsg.ebsig.com/wap/category.html的效果

它现在的数据是用ajax写的,如果换成静态的写法,要怎么写吗

伊谢尔伦
$(document).on('click','.add-pluse',function(event){

            var postID = $(this).attr('postID');

            var addcar = $(this).parent();
            var img = addcar.parent().find('img').attr('src');
            var flyer = $('<img class="u-flyer" style="width:2em;height:2em;z-index:1000"src="'+img+'">');

            E.ajax_post({
                action: "cart",
                operFlg: 2,
                data: {
                    postID: postID,
                    goods_amount: 1
                },
                call: function( o ) {
                    if (o.code == 200 ) {

                        flyer.fly({
                            start: {
                                left: event.pageX-100,
                                top: event.clientY
                            },
                            end: {
                                left: offset.left,
                                top: offset.top+50,
                                width: 0,
                                height: 0
                            }

                        });
                        shop.get_cart_num();

                    } else {
                        layer.open({content:o.message, time: 2});
                    }

                }
            });
        });

源码里就有

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号