I am using Bootstrap's Tooltips over buttons on my site but when viewed on a mobile device, these tooltips are triggered on the first click, meaning I have to double click on the button. I want to prevent these being shown on mobile devices and have tried using media queries to do so. My code has been:
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { .tooltip { display: none; } }
This stops the tooltip from displaying, but I still have to click twice to get the button to function. Is there any way I can prevent these tooltips from firing using media queries?
How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. 'manual' indicates that the tooltip will be triggered programmatically via the .
As you may know, the Twitter bootstrap tooltips are not accessible (I.E. they are not being read by screen readers).
How to position the tooltip - auto | top | bottom | left | right. When auto is specified, it will dynamically reorient the tooltip. When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second.
I have achieved it differently; Mobile and other devices are touch
enabled, so I checked if it's touch device or not.
function isTouchDevice(){ return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch); }
Now, check if it's not a touch device
to trigger the tool-tip:
if(isTouchDevice()===false) { $("[rel='tooltip']").tooltip(); }
Just use the !important flag since the tooltip position is styled inline.
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) { .tooltip { display: none !important; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With