素材牛VIP会员

jQuery仿美团外卖订餐系统手机购物车代码

 所属分类:网页特效-UI/布局/瀑布流,其他特效

 浏览:3967次  评论:0次  更新时间:2017-06-26
牛币素材VIP可免积分下载
jQuery仿美团外卖订餐系统手机购物车代码
积分说明:注册即送10牛币,每日签到可获得5牛币,成为VIP会员可永久免牛币下载!   充值积分   充值会员   更多说明»
素材描述:jQuery仿美团外卖订餐系统手机购物车代码,简洁的仿外卖平台购物车下单特效

详细介绍

核心JS部分:

$(function () {   
    //加的效果   
    $(".add").click(function () {   
        $(this).prevAll().css("display", "inline-block");   
        var n = $(this).prev().text();   
        var num = parseInt(n) + 1;   
        if (num == 0) { return; }   
        $(this).prev().text(num);   
        var danjia = $(this).next().text();//获取单价   
        var a = $("#totalpriceshow").html();//获取当前所选总价   
        $("#totalpriceshow").html((a * 1 + danjia * 1).toFixed(2));//计算当前所选总价   
           
        var nm = $("#totalcountshow").html();//获取数量   
        $("#totalcountshow").html(nm*1+1);   
        jss();//<span style='font-family: Arial, Helvetica, sans-serif;'></span>   改变按钮样式 
    });   
    //减的效果   
    $(".minus").click(function () {   
        var n = $(this).next().text();   
        var num = parseInt(n) - 1;   
 
        $(this).next().text(num);//减1   
 
        var danjia = $(this).nextAll(".price").text();//获取单价   
        var a = $("#totalpriceshow").html();//获取当前所选总价   
        $("#totalpriceshow").html((a * 1 - danjia * 1).toFixed(2));//计算当前所选总价   
          
        var nm = $("#totalcountshow").html();//获取数量   
        $("#totalcountshow").html(nm * 1 - 1);   
        //如果数量小于或等于0则隐藏减号和数量   
        if (num <= 0) {   
            $(this).next().css("display", "none");   
            $(this).css("display", "none");   
            jss();//改变按钮样式   
             return   
        }   
    });   
    function jss() {   
        var m = $("#totalcountshow").html();   
        if (m > 0) {   
            $(".right").find("a").removeClass("disable");   
        } else {   
           $(".right").find("a").addClass("disable");   
        }   
    }; 
    //选项卡 
    $(".con>div").hide(); 
    $(".con>div:eq(0)").show();     
     
    $(".left-menu li").click(function(){ 
        $(this).addClass("active").siblings().removeClass("active"); 
        var n = $(".left-menu li").index(this); 
        $(".left-menu li").index(this); 
        $(".con>div").hide(); 
        $(".con>div:eq("+n+")").show();     
    }); 
});

相关素材 - UI/布局/瀑布流,其他特效

讨论这个素材(0)回答他人问题或分享使用心得会奖励牛币

〒_〒 居然一个评论都没有……

 文明上网,理性发言!   😉 阿里云幸运券,戳我领取
我的牛币余额:0
所需牛币:5 开始下载

牛币获取:签到、评论、充值    » 在线充值(10牛币=1元)