Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] qtip with live/delegate and multiple events
9th November, 22:07 (This post was last modified: 9th November 22:07 by Tangoman.)
Post: #1
[Solved] qtip with live/delegate and multiple events
Hi,

I originally wanted to be able to bind 2 different events so that qtips appeared with a delay on a mouseover, but instantly on a click.

You helped me out there with use of events.

I'm now trying to incorporate the .live or .delegate functions as my application is ajax intensive.

I have a fiddle here: http://jsfiddle.net/wTnLL/1/
which demonstrates the problem.

Basically - if you click on the word Test immediately after loading the page, nothing happens -it's only if you first hover until a qtip is presented, that the click functionality is bound.

Is there a way to fix this?

Thanks
Tony
Find all posts by this user
Quote this message in a reply
9th November, 22:15
Post: #2
RE: qtip with live/delegate and multiple events
Well since it isn't rendered until the first show delay, you'll need to bind it after: http://jsfiddle.net/wTnLL/2/

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
10th November, 09:30
Post: #3
RE: qtip with live/delegate and multiple events
Perfect - thanks!
Find all posts by this user
Quote this message in a reply
18th November, 16:00
Post: #4
RE: [Solved] qtip with live/delegate and multiple events
I'm trying to bind a qTip to an element that is added via ajax. I've seen the examples using live() or delegate() and the mouseover event but that doesn't seem like it would work on a mobile device. Is there another way of doing this that might work better?
Find all posts by this user
Quote this message in a reply
21st November, 17:54
Post: #5
RE: [Solved] qtip with live/delegate and multiple events
Well when you populate the new elements in the DOM just re-call the same qTip init function:
JS Code
$(function() {
 
	function createTooltips() {
		$('a').qtip({
			overwrite: false, // Shouldn't need this, but just incase we want to make sure we don't re-create tooltips if they're already present!
			// Other config here
		});
	}	
 
	$.ajax({
		url: '/grabelements.php',
		success: function(html) {
			$('#dynamicContents').html( html );
			createtooltips();
		}
	});
 
	createTooltips(); // Call it once on document ready to setup all non-dynamic elements
});

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Multiple qtips one target... using an each() statement wtgmatt 1 11 20th May 21:17
Last Post: Craig
  Reload problem with multiple modal ajax views dkremer88 3 212 16th April 10:58
Last Post: dkremer88
  [Solved] one tooltip multiple elements knockoutjs thomen 3 208 31st March 17:41
Last Post: Craig
  [Solved] Content with Ajax and .live() Zweipunkt 1 246 20th March 17:00
Last Post: Craig
  [Solved] single tooltip multiple show/hide targets - hide event problem krasota 4 371 14th March 19:36
Last Post: Craig
  [Solved] Multiple show/hide events with different behaviour fraze 2 261 7th March 10:59
Last Post: fraze
  multiple targets and one window bind optimization? solid77 2 262 16th February 04:48
Last Post: solid77
  Multiple issues with qtip2 and image maps jlaw90 6 458 11th February 18:52
Last Post: Craig
  [Solved] two qtips on same element on different events witschi87 3 515 9th February 18:30
Last Post: Craig
  Problem with One tooltip, multiple targets Unpassant 0 273 1st February 14:45
Last Post: Unpassant



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