Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to dynamically destroy tooltips?
28th February, 14:27
Post: #1
How to dynamically destroy tooltips?
hi,

I have a page with a lot of thumbnails. Upon hovering a thumbnail, it shows a tooltip, with HTML details. This works fine.

However, I do not want to run an "each" loop to create these tooltips upon document load, as that is memory intensive. Instead, I want the following behavior:

- Hoverin: dynamically create the tooltip
- Hoverout: dynamically destory the previously created tooltip

I currently have the following code:

JS Code
$(document).ready(function() {
 
	$(".imagelist li a").hover(
	function () {
		$(this).qtip({
			content: $(".imagedetails",this).html().length == 0 ? "-" : $(".imagedetails",this).html(),
			style: {
				background:'#f7f7f7',
				border: {
					width: 1,
					radius: 0,
					color:'#333'
				},
				name: 'light',tip: true, width:200
			},
			position: {
				corner: {
					target: 'bottomMiddle',
					tooltip: 'topMiddle'
				}
			},
			show: { solo:true }
		});
	},
	function () {
		$(this).qtip("destroy"); // Destroys the tooltip
	}
	);
 
 
});


When I inspect the DOM using Firebug, I notice that a new tooltip is created upon each hover and that it also creates tooltips when hovering out. This quickly piles up and then it crashes the browser.

What am I doing wrong?

Note: The jQuery hover function takes two arguments, the first is the function to execute when hovering in, the second one is ran when hovering out.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Tooltips not loading jQuery or other js files from parent document crodesign 2 144 13th January 22:19
Last Post: crodesign
  [Solved] Autohide tooltips after set time phuson 25 3,022 9th December 11:40
Last Post: stevenday
  [Solved] Is there an easier way to show/hide tooltips dynamically? gloosemo 1 399 17th October 15:58
Last Post: Craig
Bug Fixed Tooltips TheKramers 0 333 16th September 05:07
Last Post: TheKramers
  [Solved] Many tooltips on image map causing slow down purplespider 2 705 2nd September 15:15
Last Post: purplespider
  [Solved] Blanket Destroy not working migdalskiy 2 379 22nd August 22:44
Last Post: migdalskiy
  [Solved] Can't dynamically update content text! hoodedperson70 9 1,014 20th July 18:47
Last Post: hoodedperson70
Bug Blinking tooltips - also happens on craigsworks.com arne 1 668 18th July 11:40
Last Post: Craig
  [Solved] old tooltips coming back jgrauer 4 424 26th June 17:55
Last Post: jgrauer
  Modal tooltips on modal tooltips Dukegatts 2 404 17th June 07:38
Last Post: Dukegatts



User(s) browsing this thread: 1 Guest(s)