Bootstrap 4 is being utilized for my current project,
I am looking to modify the rotation of the chevron icon in a multi-level dropdown menu specifically on mobile devices when the parent link is tapped,
Here is the code snippet for the multi-level dropdown menu,
Thank you
$(function() {
$("ul.dropdown-menu [data-toggle='dropdown']").on("click", function(event) {
event.preventDefault();
event.stopPropagation();
//method 2: remove show from all siblings of all your parents
$(this).parents('.dropdown-submenu').siblings().find('.show').removeClass("show");
$(this).siblings().toggleClass("show");
//collapse all after nav is closed
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
$('.dropdown-submenu .show').removeClass("show");
});
});
});
.dropdown-submenu {
position: relative;
}
.dropdown-submenu>.dropdown-menu {
top: 0;
left: 100%;
}
.dropdown-submenu>a:after {
font-family: "Font Awesome 5 Free" !important;
font-weight: 900;
content: "\f054" !important;
border: none;
position: absolute;
right: 10px;
top: 5px;
}
...
</script>
For my project, I have implemented Bootstrap 4,
The default behavior of the dropdown menu does not include rotating the chevron icon,
I simply need to adjust the chevron icon rotation on mobile devices when the link is clicked.
Appreciate it!