模板文件循环读取商品分类,并给大分类加上url属性。然后在js中判断是否有下级分类。有分类则点击下拉效果,没有子分类则跳转到url属性的链接去。
themes/**/library/category_tree.lbi:
/js/common.js:
//列表页商品分类左侧导航点击切换 $("#cate h1").click(function(){ if($(this).next("ul").find("li").length == 0) { location.href = $(this).find("a").attr("url");//location.href实现客户端页面的跳转 } else { if($(this).next("ul").is(":visible")) { $(this).next("ul").hide(); } else { $("#cate ul").hide(); $(this).next("ul").show(); } } })