jq 动态切换图标

时间:2022-05-27 22:48:59   收藏:0   阅读:22
if(!$(this).hasClass("subdrop")) {
// hide any open menus and remove all other classes
$("ul",$(this).parents("ul:first")).slideUp(350);
$("a",$(this).parents("ul:first")).removeClass("subdrop");

$("#sidebar-menu .pull-right i").removeClass("fa-chevron-down").addClass("fa-chevron-left");

// open our new menu and add the open class
$(this).next("ul").slideDown(350);
$(this).addClass("subdrop");

$(".pull-right i",$(this).parents(".has_sub:last")).removeClass("fa-chevron-left").addClass("fa-chevron-down");
$(".pull-right i",$(this).siblings("ul")).removeClass("fa-chevron-down").addClass("fa-chevron-left");

}else if($(this).hasClass("subdrop")) {
$(this).removeClass("subdrop");
$(this).next("ul").slideUp(350);

$(".pull-right i",$(this).parent()).removeClass("fa-chevron-down").addClass("fa-chevron-left");
}

原文:https://www.cnblogs.com/lilulin/p/15353287.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!