jQuery仿美团外卖APP订餐购物车代码
jQuery仿美团外卖APP订餐购物车代码,一款简洁实用的手机微信端外卖网站系统购物车结算页面源码。
在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载
js代码
<script type="text/javascript">
$(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();
});
});
</script>
在线预览
资源均来自第三方,谨慎下载,前往第三方网站下载
本站所有文章、数据、图片均来自互联网,一切版权均归源网站或源作者所有。
如果侵犯了你的权益请来信告知我们删除。邮箱:737597453@qq.com


