.classification { width:227px; height:auto; border:1px solid #e0e0e0; box-sizing:border-box; margin:0 0 15px 0; } .cf_listATitle { font-size:14px; height:14px; line-height:14px; color:#666666; padding:10px 0; font-weight:700; cursor:default; border-bottom:1px dashed #e0e0e0; } .cf_listATitle>i { display:inline-block; vertical-align:baseline; margin:0 9px 0 0; width:10px; height:11px; font-weight:bold; color:#ffffff; background:#cccccc; line-height:9px; font-style:normal; text-align:center; } .cf_listATitle>span { display:inline-block; } .cf_agClassFi { padding:10px 0; } .cf_agClassFi>a { display:inline-block; font-size:14px; height:14px; line-height:14px; margin:0 8px 0 0; text-decoration:none; color:#666666; } .cf_upClassList { padding:10px 0; } .cf_upClassList>a { display:block; font-size:14px; height:14px; line-height:14px; color:#666666; margin:0 0 15px 0; text-decoration:none; } .only_flagShip:hover,.cf_agClassFi>a:hover,.cf_upClassList>a:hover { color:#e4393c; } .cf_upClassList>a:last-child { margin:0; } .cf_upClassList>a>span { margin:0 0 0 4px; } .cf_upClassList>a>i { font-style:normal; } .only_title { font-size:14px; color:#666666; height:40px; background:#f7f7f7; line-height:40px; padding:0 10px; font-weight:bold; border-bottom:1px solid #e0e0e0; } .cf_list { padding:0 10px 10px 10px; }
各位道友:
经过某位大神的指点后,改过的代码如下:
$(function() { $(".cf_listATitle").on("click", function() { $(this).next().stop().toggle(1000, function() { console.log($(this).prev().find("i").text()); if ($(this).prev().find("i").text() == "-") { $(this).prev().find("i").text("+"); } else { $(this).prev().find("i").text("-"); } }); }); // 左侧导航 商品分类 点击隐藏 or 显示 })回复