Turn the Tooltip Bootstrap functionality off

前端 未结 5 1755
不知归路
不知归路 2020-12-24 11:04

According the documentation is is possible to turn off the functionality just doing $(\'body\').off(\'.alert.data-api\').
In the case of tooltip I tried the

5条回答
  •  天命终不由人
    2020-12-24 11:45

    You can't disable tooltips that way because it has no event listener on the body. Instead, you can disable the tooltips themselves using the code below.

    $('[rel=tooltip]').tooltip()          // Init tooltips
    $('[rel=tooltip]').tooltip('disable') // Disable tooltips
    $('[rel=tooltip]').tooltip('enable')  // (Re-)enable tooltips
    $('[rel=tooltip]').tooltip('destroy') // Hide and destroy tooltips
    

    Edit: For Bootstrap 4, the 'destroy' command has been replaced by the 'dispose' command, so:

    $('[rel=tooltip]').tooltip('dispose') // Hide and destroy tooltips in Bootstrap 4 
    

提交回复
热议问题