Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
qtip on element called with Ajax
30th August, 08:36 (This post was last modified: 30th August 08:38 by sisilone.)
Post: #1
qtip on element called with Ajax
Hello,
I've a class of elements to which I want to attach qtip. Well this works for static elements, but obviously not on the elements, of the same class, called through Ajax.
Is it possible to attach qtip also to the element called with ajax, like a method .live(), without add code for each script called async?

Share information about cities on KooKooZa!
Find all posts by this user
Quote this message in a reply
1st September, 18:12
Post: #2
RE: qtip on element called with Ajax
I'm assuming you are using an ajax function like $.ajax or $.post or $(id).load??

All you have to do is reattach the qtip to your elements in the success callback with jQuery's each function.

JS Code
$.ajax({
	type: "POST",
	url: "page.php",
	data: "yourdata=something",
	success: function(response){
 
		('.your_qTip_elements').each(function(){
      		$(this).qtip({
         		show: 'mouseover',
         		hide: 'mouseout',
                ...your qtip options
      		});
       });
 
	}
});



I hope this helps Smile
Find all posts by this user
Quote this message in a reply
2nd September, 08:11
Post: #3
RE: qtip on element called with Ajax
thank you for your answer, but it's a bad thing...I've to attach this function for every async request...

As I said I use tooltip for a specific class of elements and I create them calling a php function, I can write in this function the qtip code to attach the tooltip. I'll have n identical script for n elements of that class...it's not an elegant way...Sad

Share information about cities on KooKooZa!
Find all posts by this user
Quote this message in a reply
2nd September, 12:31
Post: #4
RE: qtip on element called with Ajax
sisilone, if you're planning on using qTip with the .live() methods I'd definitely suggest you take a look at porting your code over to the 2.0 releases. 1.x releases are quite resource heavy and can slow down your page quite bit if you have lots of them bound.

If you do move over to 2.0, you can use this as a starting point:

JS Code
// .delegate requires jQuery 1.4.2 and up. Use t he same event here as your tooltip show event
$('.selector').delegate('.selector', 'mouseover', function(event) {
   $(this).qtip({
      content: {
         ajax: {
            url: 'blah',
            data: {}
         }
      },
      show: {
         ready: true // Need this to make it show on first mouseover 
      }
   });
});


You can grab 2.0 here: http://github.com/craga89/qtip and the documentation here: http://craigsworks.com/projects/qtip_new/docs/

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
  [Solved] creating a qtip with ajax contents based on computed uri params punk.kish 1 112 25th January 15:50
Last Post: Craig
  [Solved] How to append QTip to some other element instead of document body prateekbansal 2 179 11th January 07:01
Last Post: prateekbansal
  [Solved] QTip content from existing div element on page? dcash 4 1,868 8th December 18:29
Last Post: Craig
  nested lists and qtip for the last mouseenter element ??? thbenda 0 211 4th October 09:24
Last Post: thbenda
  [Solved] Ajax element width trogo 1 584 27th September 12:37
Last Post: Craig
  Ajax call not being made from qtip sz3y1w 1 649 7th September 19:55
Last Post: Craig
Information [Solved] Qtip assigned to an element, element is destroyed and created again, qtip doesnt work lovesniper 2 849 25th August 18:29
Last Post: Craig
  [Solved] How to make qTip work with AJAX and a "enable/disable" checkbox? xzuttz 4 750 24th August 19:04
Last Post: Craig
Smile Persistent qtip which appears on hover disappears only by clicking on an element Bala 2 932 26th July 08:01
Last Post: Bala
  [Solved] About dynamic cpntent in qTip with AJAX. i.am.not.korr 10 1,611 26th April 03:46
Last Post: i.am.not.korr



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