Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Position of qTip Modal from call within a tooltip
17th January, 18:59
Post: #1
Position of qTip Modal from call within a tooltip
So I have qTip2 working succesffuly, displaying the tooltip as a modal for some ajax content. Everything is working great, except the content within the modal tooltip has links that also call another tooltip. When I click any of those, the positioning goes way off screen (like -234.5px and -300px).

I know it has something to do with the position parameters, but I can't get it to work. Could I make it use the target of the previously clicked tooltip as its position? Or is there a way to load the new ajax content in the same tooltip?

link on main page:
JS Code
<a class="qtipajaxmodal" id="[id here]" href="[link here]" rel="[ajax link here]">Main Link</a>


link within ajax pulled content:

JS Code
<a class="qtipajaxmodal" id="[id here]" href="[link here]" rel="[ajax link to somewhere else here]">Another Link</a>



JS Code
// Make sure to only match links to wikipedia with a rel tag
		   $('a.qtipajaxmodal').live('mouseover', function() {
			   // Make sure to only apply one tooltip per element!
     			if( $(this).data('qtip') === 'object' ){ return; } 
 
			  // We make use of the .each() loop to gain access to each element via the "this" keyword...
			  $(this).qtip({
				 //overwrite: false, // Make sure the tooltip won't be overridden once created
				 id: 'modal2', 
				 content: {
					// Set the text to an image HTML string with the correct src URL to the loading image you want to use
					text: '<div class="ajaxqtipmodal-load" alt="Loading..."></div>',
					ajax: {
					   url: $(this).attr('rel') // Use the rel attribute of each element for the url to load
					},
					title: {
					   text: 'Title: - ' + $(this).text(), // Give the tooltip a title using each elements text
					   button: true
					}
				 },
				  events: {
					 show: function(event, api) {
						 // Grab the tooltip element from the API
						 var tooltip = api.elements.tooltip
						 // ...and here's the extra event binds
						 tooltip.find('.ui-tooltip-titlebar').show();
					  },
					  hide: function(event, api) { 
                   		//api.destroy(); 
               		  }
				   },
				 position: {
					 target: $('#main'),
					 container: $('#main'),
					 my: 'center', // ...at the center of the viewport
				 	 at: 'center',
				 	 //viewport: $('#container'),
					 effect: false
				 },
				 show: {
					event: 'click',
					solo: true, // Only show one tooltip at a time
					modal: true,
					effect: function(offset) {
         				$(this).show(400); // "this" refers to the tooltip
      				} // ...and make it modal
 
				 },
				 hide: false,
				 style: {
					classes: 'ui-tooltip-fd-movie'
				 }
			 }).click(function(event) { event.preventDefault(); });
		   });
Find all posts by this user
Quote this message in a reply
17th January, 21:54
Post: #2
RE: Position of qTip Modal from call within a tooltip
Can you setup a test case please: http://jsfiddle.net/fdavn/

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
  can't hide qtip in a “position: absolute;” div shdog 1 275 14th March 17:35
Last Post: Craig
  [Solved] position change when tooltip is cut zuckermanori 6 419 13th February 14:17
Last Post: zuckermanori
  Why does the tooltip pop up too low and then slides up into correct position? jbrendel 3 990 16th January 04:24
Last Post: DylanKean1
  show qtip in a specified div or position myapweb 1 585 27th December 17:53
Last Post: Craig
  qTip modal accept/decline form jinx8402 0 438 15th December 13:34
Last Post: jinx8402
  ajax call with dataTable lib hanabadler 0 672 23rd September 03:42
Last Post: hanabadler
  [Solved] How to call javascript function within Qtip? When2Meets2 7 1,118 19th September 16:49
Last Post: Craig
  Ajax call not being made from qtip sz3y1w 1 890 7th September 19:55
Last Post: Craig
  [Solved] Fixed position for large tooltip? dabd 6 833 17th August 00:54
Last Post: dabd
  Efficiency - Should I re-position one qtip or create multiple? jcapper 1 954 4th July 14:19
Last Post: Craig



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