Solved

ajax funtion breaking a tooltip

Posted on 2009-07-07
2
386 Views
Last Modified: 2012-08-13
Dear all,


I'm using jquery-tooltip to add a tooltip to content generated by a $.ajax  and here's the result:
http://www.vivocomtech.net/vidzapper/jquery-tooltip/tipmix2.htm

As you'll see the only image that has got the tooltip is the one in the centre.. and I need all of them.

With     $('#content img').tooltip({
I now the programming is looking into the images of the content div, but I'm so desperate that I've added title="'+alt+'" everywhere .. and even so, it is not working ..please help!!


The usage of  jquery-tooltip:
http://jquery.bassistance.de/tooltip/demo/

And my code is below.

Thanks a million!

<link rel="stylesheet" href="http://www.vivocomtech.net/vidzapper/jquery-tooltip/lib/jquery.tooltip.css" />
<link rel="stylesheet" href="http://www.vivocomtech.net/vidzapper/jquery-tooltip/lib/screen.css" />
<script src="http://www.vivocomtech.net/vidzapper/jquery-tooltip/lib/jquery.js" type="text/javascript"></script>
<script src="http://www.vivocomtech.net/vidzapper/jquery-tooltip/lib/jquery.bgiframe.js" type="text/javascript"></script>
<script src="http://www.vivocomtech.net/vidzapper/jquery-tooltip/lib/jquery.dimensions.js" type="text/javascript"></script>
<script src="http://www.vivocomtech.net/vidzapper/jquery-tooltip/lib/jquery.tooltip.js" type="text/javascript"></script>
 
 
<script type="text/javascript">
     
     	$(document).ready(function(){
     	
			$.ajax({
				type: "GET",
				url: "myxml.xml",
				dataType: "xml",
				success: function(xml) {
				
   					$(xml).find('item').each(function(){
   					
 
						var number = $(this).find('number').text();
						var alt = $(this).find('alt').text();
						var ids = $(this).find('ids').text();
						var thumb = $(this).find('thumb').text();
 
 
      	        
      
        $('#content img').tooltip({
      	track: true,
      	delay: 0,
      	showURL: false,
      	showBody: " - ",
      	fade: 250
      })
      
 
 
			 	$('<div id="thumb'+number+'" title="'+alt+'"></div>').html('<a target="_parent"  title="'+alt+'" href="http://www.amazon.com/
music-rock-classical-pop-jazz/b?ie=UTF8&node='+ids+'"><img title="'+alt+'" src="http://player27.narrowstep.tv/assets/players/4351/xml/images/'+thumb+'.jpg"  width=82 height=62 border=0></a>').appendTo('#content');
		
					});
				}
			});
 
		});
		
 
 
</script>
 
</head>
<body>
 
	<div id="content">
 
     </div>
 
////// xml file //////////////////////
 
<?xml version="1.0" encoding="iso-8859-1"?>
<myxml>
 
   <item>
  
        <thumb>thumb1</thumb>
        <ids>5171</ids>
        <alt>Some text 1</alt>
        <number>1</number>
    </item>
   
   
    <item>
      
        <thumb>thumb2</thumb>
        <ids>5172</ids>
        <alt>Some text 2</alt>
         <number>2</number>
     </item>
   
   
  
   
      <item>
 
        <thumb>thumb3</thumb>
        <ids>5173</ids>
        <alt>Some text 3</alt>
         <number>3</number>
      </item>
 
</myxml>

Open in new window

0
Comment
Question by:Dada44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 500 total points
ID: 24793975
Append all your items to the content first, then apply the tooltips.
<script type="text/javascript">
$(document).ready(function(){
	$.ajax({
		type: "GET",
		url: "myxml.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('item').each(function() {
				var number = $(this).find('number').text();
				var alt = $(this).find('alt').text();
				var ids = $(this).find('ids').text();
				var thumb = $(this).find('thumb').text();
 
				$('<div id="thumb'+number+'" title="'+alt+'"></div>').html('<a target="_parent"  title="'+alt+'" href="http://www.amazon.com/music-rock-classical-pop-jazz/b?ie=UTF8&node='+ids+'"><img title="'+alt+'" src="http://player27.narrowstep.tv/assets/players/4351/xml/images/'+thumb+'.jpg"  width=82 height=62 border=0></a>').appendTo('#content');
			});
 
			$('#content img').tooltip({
				track: true,
				delay: 0,
				showURL: false,
				showBody: " - ",
				fade: 250
			});
		}
	});
});
</script>

Open in new window

0
 

Author Closing Comment

by:Dada44
ID: 31600568
Thanks!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question