Keep Bootstrap dropdown open on click

后端 未结 7 1016
我寻月下人不归
我寻月下人不归 2020-12-08 01:54

I use a bootstrap dropdown as a shoppingcart. In the shopping cart is a \'remove product\' button (a link). If I click it, my shoppingcart script removes the product, but th

7条回答
  •  无人及你
    2020-12-08 01:58

    I wrote some lines of code that make it works as perfect as we need with more of control on it:

    $(".dropdown_select").on('hidden.bs.dropdown', function () {
        if($(this).attr("keep-open") == "true") {
            $(this).addClass("open");
            $(this).removeAttr("keep-open");
        }
    });
    
    $(".dropdown_select ul li").bind("click", function (e) {
        // DO WHATEVER YOU WANT
        $(".dropdown_select").attr("keep-open", true);
    });
    

提交回复
热议问题