Fork me on GitHub

树状jquery导航条

    $(function () {
        $(".leftsecoundtitle").css({ "display": "none" });
        $("#id1").toggle(
      function () {
          $("#id1 + .leftsecoundtitle").slideDown("normal");
          $(this).css("background", "#E1E1E1");
          //$(".zsfl-item .zsfl-img").css("background", "#E1E1E1");
      },
      function () {
          $("#id1 + .leftsecoundtitle").slideUp("normal");
          $(this).css("background", "whiteSmoke");
      }

    );
    });

最终版
        $(function () {
            $(".leftsecoundtitle").css({ "display": "none" });
        });

        function MySlide(id) {
            if ($("#" + id + " + .leftsecoundtitle").css("display") == "none") {
                $("#" + id + " + .leftsecoundtitle").slideDown("normal");
                $("#"+id).css("background", "#E1E1E1");
            }
            else if ($("#" + id + " + .leftsecoundtitle").css("display") == "block") {
                $("#" + id + " + .leftsecoundtitle").slideUp("normal");
                $("#" + id).css("background", "whiteSmoke");
            }
        }

posted @ 2014-04-21 13:57  乔闻  阅读(161)  评论(0编辑  收藏  举报