Skip to content

Instantly share code, notes, and snippets.

@yanis-git
Created October 16, 2014 10:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanis-git/2b80afc384a9666d4696 to your computer and use it in GitHub Desktop.
Save yanis-git/2b80afc384a9666d4696 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($) {
/**
* Demo Section : Mettre en avant ses alternatives textuelles sur les devices tactiles.
**/
$("a[data-toggle='tooltip'], img[data-toggle='tooltip']").on("click",function(){
if(!$('.tooltip').hasClass('in')){ //Si l'info-bulle n'est pas visible.
$(this).tooltip("show");
return false; // Empecher le navigateur d'ouvrir la destination du lien.
}
});
$(document).click(function(){ //Désactiver l'info-bulle quand on clique autre part.
$("a[data-toggle='tooltip'], img[data-toggle='tooltip']").tooltip("hide");
});
$("a[data-toggle='tooltip'], img[data-toggle='tooltip']").on("focus",function(){
$(this).tooltip("destroy");
});
$("a[data-toggle='tooltip'], img[data-toggle='tooltip']").on("hover",function(){
$(this).tooltip("destroy");
});
$("a[data-toggle='tooltip'], img[data-toggle='tooltip']").dblclick(function(){
window.location.href = $(this).attr("href");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment