Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] multiple images as a tooltip
27th July, 08:07 (This post was last modified: 27th July 08:08 by nana.)
Post: #1
[Solved] multiple images as a tooltip
Hi there, from the demo i can load the tooltip image.
but what if i have more than one image?
how should i code for the js?
pls help as i hav no idea for the js things.
Thanks a lot Smile

here is my code:

HTML Code
<ul id="c-title">
   <li class="c-01">Test1</li>
   <li class="c-02">Test2</li>
   <li class="c-03">Test3</li>
</ul>


JS Code
<script type="text/javascript">
$(document).ready(function() 
{
   $('#c-title li.c-01').qtip({
      content: '<a href="http://google.com"><img src="images/campaigns/c-01.gif" alt="" /></a>',
	  position: {
	  	 corner: { target: 'rightMiddle', tooltip: 'leftMiddle'}
	  },
	  show: { when: { event: 'click' } },
	  hide: { when: { event: 'unfocus' } },
      style: {
      	padding: 0,
		border: 0,
      	background: 'transparent',
      	textAlign: 'left'
	  }
   });
});
</script>
Find all posts by this user
Quote this message in a reply
28th July, 21:05
Post: #2
RE: multiple images as a tooltip
Try using a .each() loop nana,

JS Code
<script type="text/javascript">
$(document).ready(function() 
{
   $('#c-title li.c-01').each(function() {
		var url = 'images/campaigns/' + $(this).attr('class') + '.gif';
 
		$(this).qtip({
			content: '<a href="http://google.com"><img src="' + url + '" alt="" /></a>',
			position: {
				corner: { target: 'rightMiddle', tooltip: 'leftMiddle'}
			},
			show: 'click',
			hide: 'unfocus',
			style: {
				padding: 0,
				border: 0,
				background: 'transparent',
				textAlign: 'left'
			}
		});
	});
});
</script>

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
  stuck qTip on images in tablerow ulktante 0 240 6th December 08:32
Last Post: ulktante
  [Solved] qTip image map multiple triggers for one tip nico 4 720 3rd August 05:43
Last Post: nico
  [Solved] Using same tooltip object for multiple elements rextheranter 3 524 1st August 15:26
Last Post: Craig
  Efficiency - Should I re-position one qtip or create multiple? jcapper 1 741 4th July 14:19
Last Post: Craig
  [Solved] multiple qtips and 1.4.2 - popup not being removed michaelg 9 2,385 11th May 13:57
Last Post: cooldeeps
  qtip for dynamic images & content cooldeeps 2 1,007 6th May 16:30
Last Post: cooldeeps
  [Solved] Multiple image maps, different tooltips glennp 1 1,001 21st April 16:32
Last Post: tafs7
  [Solved] Multiple <a> with unique id, content from multiple div slima 2 925 28th March 15:02
Last Post: slima
  Simple qtip for images in a list oneworld95 6 1,580 27th March 13:18
Last Post: scylla
  Multiple nested tooltips, child mouseout closes parent Spazsquatch 2 1,159 10th February 17:22
Last Post: Spazsquatch



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