您可以在致电INIT之前对触摸事件进行检查。这将使您可以禁用大多数触摸设备的
bootstrap tooltip
tooltip
无需进行任何脚本,是一种解决方案:首先在工具提示上添加自定义类:
if(!('ontouchstart' in window))
{
$('#example').tooltip(options); // <-- Example code from Bootstrap docs
}
<button data-bs-toggle="tooltip" data-bs-custom-class="my-class" title="Hide me on small screens">
tooltip text
</button>
可能是这样的:
@media (max-width: 992px) {
.my-class {
display: none;
}
}
solution
:if ( $(window).width() < 780 ){
$('#element').tooltip('destroy');
}