Welcome Guest ( Log In | Register )

Tooltip Example 10.6
djwave28
post Jan 8 2009, 12:01 PM
Post #1


New Member
*

Group: Members
Posts: 3
Joined: 7-January 09
Member No.: 1,927



Prototype JavaScript framework, version 1.6.0.3
Tooltip example 10-6

I have been struggling with this example. I have not yet implemented the Ajax functionality, though the tooltip does not seem to position in FF and Safari. Making an adjustment in the function positionToolTip by adding the pixel unit does the trick.

return({
top: tipTop+"px",
left: tipLeft+"px",
});


I know it is minor, but imperative for this code to work cross-browser. wink.gif
And while I am at it to complete the code, the tooltip functionality should be evoked while loading the document. It is mentioned in the comments of the code, but hey .. why not paste the code here. Place this at the beginning.

if(window.addEventListener) window.addEventListener('load', loadToolTips, false);
else attachEvent('onload', loadToolTips);

Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 6)
anthony3
post Jan 9 2009, 07:44 AM
Post #2


Active Member
**

Group: O'Reilly Author
Posts: 14
Joined: 17-September 08
From: Shiloh, IL
Member No.: 911



You are absolutely right about the positionToolTip function needing the px. My fault that I missed that, and I will make sure that gets in the errata.

Since the example is already using Prototype, let's change that event listener to:

CODE
Event.observe(window, 'load', loadToolTips, false);


Thanks for the catch of this error!
Go to the top of the page
 
+Quote Post
djwave28
post Jan 13 2009, 04:13 PM
Post #3


New Member
*

Group: Members
Posts: 3
Joined: 7-January 09
Member No.: 1,927



I have another thing with this code. I am trying to catch the scroll value. No matter what I keep getting the value "0" as in zero.
Looking around on the internet I get a referal to using documentElement as in:

valueScrollTop = document.documentElement.scrollTop;

This statement gives me a perfect value. The original "document.body.scrollTop" comes up with a constant zero. The issue seems to evolve around the usage of a DOCTYPE.
I don't know if it is stanrdard issue to leave out the DOCTYPE with Ajax, but I doubt that.


What is going on here? blink.gif
Go to the top of the page
 
+Quote Post
djwave28
post Jan 16 2009, 12:40 PM
Post #4


New Member
*

Group: Members
Posts: 3
Joined: 7-January 09
Member No.: 1,927



I must start with apologizing for the post above. It goes beyond the scope of the book and is more an issue for a book on "Browser Hell" angry.gif Look around on the internet on the use of the doctype with javascript and you'll find enough on that.

I did make an adjustment to the mouseMovement function making use of prototype's pointX and pointY, which is also available in version 1.5.1.1. It simplifies this function.

CODE
function mouseMovement(e) {
mousePosition = {
x: e.pointerX(e),
y: e.pointerY(e)
};
}


On with the work .. wink.gif
Go to the top of the page
 
+Quote Post
Seemi
post Aug 21 2009, 07:12 AM
Post #5


Active Member
**

Group: Members
Posts: 20
Joined: 21-August 09
Member No.: 19,829



Have anyone has read the book so called BROWSER HELL??


--------------------
Does Someone Do Medical Assistant Jobs like me? then please guide me to start a Medical Assistant Career.
Go to the top of the page
 
+Quote Post
bigbigball
post Aug 26 2009, 01:04 AM
Post #6


New Member
*

Group: Members
Posts: 2
Joined: 26-August 09
Member No.: 19,889



I did make an adjustment to the mouseMovement function making use proprietaire simulation rachat credit immobilier consommation - demander un rachat de crédit, faites une simulation rachat de credit en ligne.proprietaire simulation rachat credit immobilier consommation
Go to the top of the page
 
+Quote Post
luckystar09
post Sep 3 2009, 01:08 AM
Post #7


New Member
*

Group: Members
Posts: 2
Joined: 17-August 09
Member No.: 19,775



I was confused. Thanks for you information
free tattoo removal cream before and after lazer prices this is the blog for tattoo removal cream prices and cost. the best cream to pruchase free tattoo removal cream before and after lazer prices
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 22nd November 2009 - 05:04 PM