How do I change a glyphicon upon clicking it in Bootstrap 3.2?

前端 未结 3 1553
天涯浪人
天涯浪人 2021-01-01 02:11

I want to have an arrow pointing to the right to allow the user to expand the sidebar, and then change that glyphicon to point to the left. That way, it points to the left s

3条回答
  •  耶瑟儿~
    2021-01-01 02:43

    Just use:

    $('#menu-toggle').click(function(){
        $(this).find('i').toggleClass('glyphicon-arrow-right').toggleClass('glyphicon-arrow-left');
    });
    

    Fiddle Example

提交回复
热议问题