rrrene / tipsy.hovercard

Hovercard extension for tipsy tooltip
http://rrrene.github.io/tipsy.hovercard/
33 stars 3 forks source link

How to make this bind with live ? #2

Closed kingster closed 12 years ago

kingster commented 12 years ago

Live doesnt work with this plugin, how do I make hovercard work with live added data ?

rrrene commented 12 years ago

You will have to initialize the new elements by hand using $(selector).tipsyHoverCard();

Since the plugin uses jQuery's hover method (or hoverIntent, if available) live added data does not work "out of the box"...

P.S. The other option would of course be to rewrite the plugins hover statements into on handlers.

kingster commented 12 years ago

Hi

I tried to use the tipsy live method and used method as 'hover' but that throws a lot of error with this plugin.

Can you guide me with your second method, or atleast make it compatible with tipsy live?

rrrene commented 12 years ago

You misunderstood my answer. In short: Just follow my first advice

You will have to initialize the new elements by hand using $(selector).tipsyHoverCard();

or patch the plugin and send me a pull request.

kingster commented 12 years ago

Its not possible to reinitialize hovercard everytime, because the ajax requests are made and random and new items are named same as older , re initializing would overload earlier ones.

And It not that I didn't try patching the plugin, If i had succeeded I wouldn't have made this issue.

rrrene commented 12 years ago

Its not possible to reinitialize hovercard everytime, because the ajax requests are made and random and new items are named same as older , re initializing would overload earlier ones.

I really don't understand that sentence...

But I took a few minutes after work to fix the issue with live added elements. It should work now. If you are curious, here is the patch: https://github.com/rrrene/tipsy.hovercard/commit/d3c53bfab63a237b3fb4575045dee79de59ae4be

kingster commented 12 years ago

Hi

thanks for the patch, but every time a new element is hovered for first time it throws this error

this.data("tipsy") is undefined

and shows the html as default mouse hover in firefox

however it works second time when the same element is hovered.

I am using the data-url method

Any suggestions?

kingster commented 12 years ago

Everything works like a charm now :)

Thanks a lot!