可以根据设备屏幕尺寸关闭bootstrap工具提示?

问题描述 投票:0回答:4

您可以在致电INIT之前对触摸事件进行检查。这将使您可以禁用大多数触摸设备的

bootstrap tooltip
jquery css twitter-bootstrap
4个回答
13
投票
tooltip


无需进行任何脚本,是一种解决方案:

首先在工具提示上添加自定义类:
if(!('ontouchstart' in window))
{
  $('#example').tooltip(options); // <-- Example code from Bootstrap docs
}

5
投票
然后为此课程添加媒体规则:

<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; } }
    

1
投票
i测试了这个简单的

solution

if ( $(window).width() < 780 ){
    $('#element').tooltip('destroy');
}

0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.