chinchang / hint.css

A CSS only tooltip library for your lovely websites.
https://kushagra.dev/lab/hint/
MIT License
8.42k stars 701 forks source link

Activate with Javascript #67

Closed eipark closed 8 years ago

eipark commented 10 years ago

I'm not sure if this is possible, but it'd be nice to show/hide the hover programatically with javascript. Something along the lines of

$(".data-hint-class').show()/.hide()

taystack commented 10 years ago

You can if you pseudo it up with a :before selector. This issue was presented by me a few months ago. I required tooltips on a contextual basis, whether or not the user wanted tooltips.

$('.data-hint-class:before').hide()/show()

This worked.

eipark commented 10 years ago

@taystack could you elaborate on this a bit? Also, I need to be able to change the text of the hint dynamically. Not sure if that changes things.

taystack commented 10 years ago

I would need no know the context of the code. If you fiddle they will come. On Jan 28, 2014 1:46 PM, "Ernie" notifications@github.com wrote:

@taystack https://github.com/taystack could you elaborate on this a bit? Also, I need to be able to change the text of the hint dynamically. Not sure if that changes things.

Reply to this email directly or view it on GitHubhttps://github.com/chinchang/hint.css/issues/67#issuecomment-33530340 .

eipark commented 10 years ago

Basically on a click event, I replace the data-hint prop with some other string and then show the tooltip for a few seconds and then hide. Whenever the data-hint changes I want to show it without the user having to hover with their mouse.

Something like this ideally:

$("#something").on('click', function() {
   $(".hint-class").attr("data-hint", "some other text").show()
   setTimeout($(".hint-class").hide(), 2000)
});