Solved

Mootools tooltip used inside of jquery??

Posted on 2009-07-03
4
693 Views
Last Modified: 2013-11-19
Hi all,

The code below shows three thumbnails with link and alt text . The
info is coming  from the xml file and I'm using $.ajax to place it in
the page.

Now I want to add a tooltip that is using Mootools.

I have to add title="The tooltip::I want to read" class="tipz" to the
div (or to the image, changing the function) in order to use the
tooltip.

But when generating the code dynamically using $.ajax, the tooltip
code will work always for Safari (though it only shows half the
tooltip), but just sometimes for IE and Firefox.
When it does not work, the text shows like a normal alt tag text.
Using IE or Firefox just keep reloading the page and put your mouse
over the thumbnails to test it,  you'll see what I mean.

I'm adding an example at the bottom of the page (the div called
example) so you can see how nicely it works in a static div.

The code is below, but you can see it in action:
http://www.vivocomtech.net/vidzapper/tipmix2.htm

Can it be done? Can I add the tooltip to the dynamically generated
code? Seems that the tooltip code go wrong when acts before the div is
created .. is that the problem? how can I solve it?

Thanks a ton!
<script type="text/javascript" src="http://player27.narrowstep.tv/assets/players/4351/xml/jquery.js"></script>
<script language="javascript" type="text/ecmascript" src="http://www.vivocom.tv/js/moo1.2.js"></script>
 
 
  
  <style>
  
 
#thumb1{
	position: absolute;
	width:82px;
	height:62px;
	top:16px;
	left:5px;
 
}
#thumb2{
	position: absolute;
	width:82px;
	height:62px;
	top:16px;
	left:88px;
 
}
#thumb3{
	position: absolute;
	width:82px;
	height:62px;
	top:16px;
	left:171px;
 
}
 
	.tip				{ width:139px; font-family:arial; COLOR: #fff;	line-height: 16px; }
		.tip-top			{ }
		.tip-title		{ 	PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-FAMILY:Arial; FONT-WEIGHT: bold; FONT-SIZE: 12px; BACKGROUND: url(http://www.vivocom.tv/images/smoke.png) left top; PADDING-BOTTOM: 4px; MARGIN: 0px; COLOR: #ff2228; PADDING-TOP: 8px }
		.tip-text		{ 	PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-FAMILY:Arial; FONT-SIZE: 11px; BACKGROUND: url(http://www.vivocom.tv/images/smoke.png) right bottom; PADDING-BOTTOM: 8px; PADDING-TOP: 4p}
		.tip-bottom		{ }
 
 
#example{
	position: absolute;
	width:100px;
	height:100px;
	top:96px;
	left:171px;
 
}
 
</style>
 
 
  </style>
  
  
  
       
     	<script>
            
          
            
  window.addEvent('domready',function(){
	
  	//store titles and text
			$$('div.tipz').each(function(element,index) {
				var content = element.get('title').split('::');
				element.store('tip:title', content[0]);
				element.store('tip:text', content[1]);
			});
			
			//create the tooltips
			var tipz = new Tips('.tipz',{
				className: 'tipz',
				fixed: false,
				hideDelay: 50,
				showDelay: 50
			});
 
})
 
 
			jQuery.ajax({
				type: "GET",
				url: "myxml.xml",
				dataType: "xml",
				success: function(xml) {
					jQuery(xml).find('item').each(function(){
						//var numero = $(this).attr('id');
						var number = jQuery(this).find('number').text();
						var alt = jQuery(this).find('alt').text();
						var ids = jQuery(this).find('ids').text();
						var thumb = jQuery(this).find('thumb').text();
			
  		
   	jQuery('<div title="'+alt+'" class="tipz" id="thumb'+number+'"></div>').html('<a target="_parent" href="http://www.amazon.com/music-rock-classical-pop-jazz/b?ie=UTF8&node='+ids+'"><img src="http://player27.narrowstep.tv/assets/players/4351/xml/images/'+thumb+'.jpg" alt="'+alt+'" width=82 height=62 border=0 ></a>').appendTo('#content');
 
 
					});
				}
			});
 
			    
 
 
</script>
 
 
 
 
  </head>
  <body>
  
  
 
	<div id="content">
 
     </div>
          
  
  <br><br>
<div id="example" title="The tooltip::I want to read" class="tipz">Put your mouse over here <img src="http://player27.narrowstep.tv/assets/players/4350/images/tip.jpg" border="0"></div>
 
////////////////////////// the xml file below/////////////////////////////////////////////////////////////
 
<?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
4 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 250 total points
ID: 24788691
The latest MooTools framework introduced a compatibility mode, so you could use mootools with another framework (in your case, jquery)

http://mootools.net/blog/2009/06/19/mootools-123-released/

However, it's not recommended...  Isn't there a jQuery toltip plugin you could use?  There are probably hundreds of them

Tim
0
 
LVL 40

Assisted Solution

by:Richard Quadling
Richard Quadling earned 250 total points
ID: 24788975
jQuery also has a compatibility mode. Make sure they are all is use.
0

Featured Post

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Node.js 11 82
why is my slideshow so small on this wordpress site? 7 41
Dropdown animation to normal dropdown 6 29
Tell me if I understand this correctly... 6 21
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

710 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