Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] qTip image map multiple triggers for one tip
31st July, 17:09
Post: #1
[Solved] qTip image map multiple triggers for one tip
I have an image map that I am using qTip with. It works great, so thanks for the awesome plugin. I have it set up so there are dots on the map that act as triggers to the qTips.

I want to have a legend beside the map, and the items in the legend also act as triggers to the qTips that are on the map.

Since the map has about 50 qTips, I'm using the each() method.

How can I make multiple triggers for one tip, without hard-coding each tip?

Thanks!

JS Code
$('area.blue').each(function()
   {
      $(this).qtip(
      {
         content: $(this).attr('alt'), // Use the ALT attribute of the area map
         style: {
			background: '#FFF',
      		textAlign: 'center',
        	color: '#78716E',
            name: 'dark', // Give it the preset dark style
            border: {
               width: 6,
			   color: '#27aae1',
               radius: 0 
            }, 
            tip: 
				true,// Apply a tip at the default tooltip corner
				size: { x:20, y: 8},
 
         },
        position: {
			corner: {
				target: 'topMiddle',
				tooltip: 'bottomLeft'
		  	},
			adjust: {
				screen: true
			}
     	},
		show: {
			delay: 0,
			effect: {
				type: 'fade',
				//length: 1000
			},
		}
 
      });
 
   });
Find all posts by this user
Quote this message in a reply
1st August, 15:12
Post: #2
RE: qTip image map multiple triggers for one tip
Multiple triggers as in multiple targets that will open the tooltips? That's possible, but I'd suggest using using qTip2 for it instead as it has native support for it built in Smile

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
2nd August, 00:44
Post: #3
RE: qTip image map multiple triggers for one tip
(1st August 15:12)Craig Wrote:  Multiple triggers as in multiple targets that will open the tooltips? That's possible, but I'd suggest using using qTip2 for it instead as it has native support for it built in Smile

Thanks for the reply. I've installed qTip2, and looked through the documentation, but I don't see anything about what I am looking to accomplish (not one tooltip, multiple targets).

I have an image map with dots on it. When you hover a dot, the qTip shows. That's working great. What I want to do is also have the text in the legend make the associated qTip appear on the map. For example, dot 1 on the map makes the qTip show beside it, and item 1 in the legend also makes dot 1's qTip show on the map.

Any pointers you can provide would be great. Thanks!
Find all posts by this user
Quote this message in a reply
2nd August, 10:41
Post: #4
RE: qTip image map multiple triggers for one tip
Assuming the <area> elements on your map are in the same order as those elements you want to also trigger the qtip:
JS Code
$('.legend a').hover(function(event) {
	var i = $(this).index(); // It's index in relation to it's siblings
 
	// If we moused onto it, show the tooltip, otherwise hide it
	$('.imagemap area').eq(i).qtip('toggle', event.type === 'mouseenter');
});

Or you could even do it by declaring multiple show/hide targets for each qTip (assuming again the dots are in the same order as the legends that trigger them)
JS Code
$('.imagemap area').each(function() {
	var self = $(this),
		index = $(this).index(),
		targets = self.add( $('.legend a').eq(i) );
 
	$(this).qtip({
		content: 'blah',
		show: {
			target: targets
		},
		hide: {
			target: targets
		}
	});
});

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
3rd August, 05:43
Post: #5
RE: qTip image map multiple triggers for one tip
(2nd August 10:41)Craig Wrote:  Assuming the <area> elements on your map are in the same order as those elements you want to also trigger the qtip:
JS Code
$('.legend a').hover(function(event) {
	var i = $(this).index(); // It's index in relation to it's siblings
 
	// If we moused onto it, show the tooltip, otherwise hide it
	$('.imagemap area').eq(i).qtip('toggle', event.type === 'mouseenter');
});

Or you could even do it by declaring multiple show/hide targets for each qTip (assuming again the dots are in the same order as the legends that trigger them)
JS Code
$('.imagemap area').each(function() {
	var self = $(this),
		index = $(this).index(),
		targets = self.add( $('.legend a').eq(i) );
 
	$(this).qtip({
		content: 'blah',
		show: {
			target: targets
		},
		hide: {
			target: targets
		}
	});
});

Perfect! Thanks so much Smile
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Multiple qtips on one page, content disappearing russau 3 123 3rd May 16:38
Last Post: Craig
  [Solved] qTip2 inside map infowindow costales 3 194 15th April 08:29
Last Post: costales
  [Solved] Center tooltip on page and also use a thumb image to popup the real image ChileCaliente 2 257 26th March 22:54
Last Post: ChileCaliente
  [Solved] Problem with my map area installation timtimd 1 244 14th March 17:34
Last Post: Craig
  [Solved] One Target Multiple Tool Tips rd42 1 267 19th February 18:24
Last Post: rd42
  Qtip "tip" won't display in IE9 cmiller 1 605 21st November 00:55
Last Post: Craig
  [Solved] add an image to the qtip? knowlton 2 1,004 21st October 04:58
Last Post: nevf
  [Solved] Many tooltips on image map causing slow down purplespider 2 1,056 2nd September 15:15
Last Post: purplespider
  [Solved] Dynamic content based off map area befeetback 1 1,048 25th August 18:23
Last Post: Craig
  [Solved] Using same tooltip object for multiple elements rextheranter 3 801 1st August 15:26
Last Post: Craig



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