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
  [Solved] Pausing Vimeo on tooltips called with AJAX? daver_cl 4 392 14th March 20:39
Last Post: Craig
  [Solved] ColdFusion & Tooltips shimmoril 2 339 13th February 14:48
Last Post: shimmoril
  Tooltips not loading jQuery or other js files from parent document crodesign 2 484 13th January 22:19
Last Post: crodesign
  [Solved] Autohide tooltips after set time phuson 25 4,147 9th December 11:40
Last Post: stevenday
  [Solved] Is there an easier way to show/hide tooltips dynamically? gloosemo 1 688 17th October 15:58
Last Post: Craig
  Fixed Tooltips TheKramers 0 491 16th September 05:07
Last Post: TheKramers
  [Solved] Many tooltips on image map causing slow down purplespider 2 1,062 2nd September 15:15
Last Post: purplespider
  [Solved] Blanket Destroy not working migdalskiy 2 514 22nd August 22:44
Last Post: migdalskiy
  [Solved] Can't dynamically update content text! hoodedperson70 9 1,300 20th July 18:47
Last Post: hoodedperson70
  Blinking tooltips - also happens on craigsworks.com arne 1 920 18th July 11:40
Last Post: Craig



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