How To Make Tooltip With Pure Javascript (onclick Show/dismiss)
I need to use some JS no JQuery plugins to make a simple tooltip. When I click on image I want to display div with triangle corner below that image with some text inside. I Google
Solution 1:
If you're willing to use jquery, but not a plugin, then this can be done pretty simply.
var h = false;
$("#container").hover(function(){
if (h == false){
$("#popUp").fadeIn();
$("#popUpText").fadeIn();
h = true;
}
},function(){
if (h == true){
$("#popUp").fadeOut();
$("#popUpText").fadeOut(function(){h=false});
}
});
For click instead of hover:
var h = false;
$("#container").click(function(){
if (h == false){
$("#popUp").fadeIn();
$("#popUpText").fadeIn(function(){h = true;});
}
if (h == true){
$("#popUp").fadeOut();
$("#popUpText").fadeOut(function(){h=false});
}
});
Post a Comment for "How To Make Tooltip With Pure Javascript (onclick Show/dismiss)"