Spontaneous Publicity
blogs are the new phone book

Yui.Net: The Tooltip

June 20, 2007 10:40 by Luke
Tooltip

As part of my ongoing series covering the Yui.Net library (an asp.net wrapper for the Yahoo User Interface Library), today I will cover a fairly simple but useful component - the ToolTip. This component is exactly what you would expect it to be - a ToolTip which you can associate with any element on the page. The nice thing about the YUI ToolTip is that it can contain html code, can be styled via css and it can have animations applied to it.

Lets start with a simple example - a div with a basic tool tip. As with all Yui.Net controls, you must first include the YahooScriptManager on your page:

<yui:YahooScriptManager ID="manager" runat="server" />

Next, we'll just place a simple div:

<div id="content">Just a simple div</div>

then we can place our ToolTip control on the page:

<yui:Tooltip ID="toolTip" runat="server" ContextID="content" Text="This is a simple tooltip!" />

this will cause a simle tooltip popup when you place your mouse over the div. Lets take a look at the code that is generated by these controls. First, there are the necessary script tags managed by the YahooScriptManager:

<script src="http://yui.yahooapis.com/2.2.2/build/yahoo-dom-event/yahoo-dom-event.js" type="text/javascript"></script>

then there is the javascript initialization of the tooltip object:

var toolTip = new  YAHOO.widget.Tooltip("toolTip", { 
    visible: false, constraintoviewport: true, iframe : false, 
    context: "content", text: "This is a simple tooltip!"} );

That is all that is really needed for a basic tooltip. Now, lets add a fade animation so that the ToolTip will fade in an out nicely:

<yui:Tooltip ID="toolTip" runat="server" ContextID="content" Text="This is a simple tooltip!">
    <Animations>
        <yui:Animation Type="Fade" Duration="3" />
    </Animations>
</yui:Tooltip>

This will cause an extra script reference to be generated by the YahooScriptManager:

<script src="http://yui.yahooapis.com/2.2.2/build/animation/animation-min.js" type="text/javascript"></script>

Whenever possible the YahooScriptManager will only include the references needed for the needed functionality so the animation library is only included if a control on the current page will need animation. Actually, it is not the YahooScriptManager that makes this decision but it is the controls themselves. Now the generated javascript looks like:

var toolTip = new  YAHOO.widget.Tooltip("toolTip", 
    { visible: false, effect: 
    {effect:YAHOO.widget.ContainerEffect.FADE,duration:0.3}, 
    constraintoviewport: true, iframe : false, context: "content", 
    text: "This is a simple tooltip!"} );

That is about all you really need to know about the ToolTip control to get started. Pretty standard really. Next up I will cover the FloatPanel control and some new features I am building into the YUI.Net library for dealing with javascript events.


Tags:
Categories:
Actions: E-mail | del.icio.us | Permalink | Comments (76) | Comment RSSRSS comment feed

Comments

July 20. 2010 08:33

web cam sex

Topics from here helped me a lot. really admire your work, keep it up!

web cam sex

July 21. 2010 14:45

hotmail hack

Perfect immediately after browsing for a legitimate hotmail password hack strategy, I uncovered this software. Be careful with it despite the fact that, I'm not confident if in any respect legal to apply it to hack someones hotmail or yahoo account password, its only legal to utilize it alone when you ever forget the password. http://www.hotmailpasswordhack.net

hotmail hack

July 28. 2010 21:06

natural cures for bacterial vaginosis

Amazing article, a lot of valuable information.

natural cures for bacterial vaginosis

July 31. 2010 05:00

Coach outlet

Your article is very characteristic, I like reading, to work!

http://www.guccihandbagsoutlet.com/   Gucci handbags
http://www.coachoutletmalls.com/   Coach factory outlet
This article is written by zocy003 on 2010-7-31

Coach outlet

July 31. 2010 13:23

LunarPages Review

Thank you for this post, It's great to see another BlogEngine.NET user. Most users these days tend to use Wordpress, but I think BlogEngine.NET is the best system to use.

LunarPages Review

August 1. 2010 06:25

stavba na kluc

I really enjoyed reading your posts. They are all well written and informative. Congratulations on you achievement.

stavba na kluc

August 2. 2010 02:46

targus laser pointer

Took me awhile to read all the comments, but I really enjoyed the article. It proved to be very useful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also engaged! I'm sure you had fun writing this article.

targus laser pointer

August 2. 2010 04:50

Big AssDolls

Ver good site! I am loving it!! Will come back again - taking your feeds also. Thanks.

Big AssDolls

August 3. 2010 05:11

Real Big Tits

Hey, very nice blog! Beautiful and Amazing. I will bookmark your blog and take the feeds also

Real Big Tits

August 3. 2010 15:57

Theron Schonberg

<a href="http://www.cheapnfl.us">cheap nfl</a>

Theron Schonberg

August 4. 2010 00:51

iPhone proof

I don't completely agree, but the principle is right, and you're heart is in the right place.

iPhone proof

August 6. 2010 17:50

webcam sex

Being a new blogger, I would like to tell you that you have given me much knowledge about it. I will still read your blog. Thanks! <a href="http://www.naughtywebcamsex.com" title="Webcam Girls">Webcam Girls</a>

webcam sex

August 7. 2010 22:55

get girls

Thank you for making the sincere attempt to discuss this. I feel pretty strong about it and would like to learn more. If it's OK, as you gain more in depth knowledge, would you mind writing more articles similar to this one with more information? It would be very helpful and useful for me and my colleagues.

get girls

August 8. 2010 01:00

garden-bridge

Ha, can't say you're wrong. Just need to get my head around this.

garden-bridge

August 8. 2010 01:01

iPhone information

I like that you've touched on this subject, it's somewhat of a rariety.

iPhone information

August 9. 2010 15:51

Tyson F. Gautreaux

Great blog, keeping me from working

Tyson F. Gautreaux

August 10. 2010 16:06

Fae Seiler

This is actually the 2nd instance I have encountered your webblog within the last couple weeks.  Seems as if I should bookmark it.

Fae Seiler

August 11. 2010 04:39

usb data transfer cable

You made fantastic nice points here. I performed a search on the issue and discovered almost all peoples will agree with your blog.

usb data transfer cable

August 15. 2010 14:39

Jessenia Billue

This is just the sort of info I was looking for! Thanks

Jessenia Billue

August 15. 2010 14:41

Dwayne Viltz

I’ve recently started a blog, the information you provide on this site has helped me how to write a article tremendously. Thank you for all of your time & work.

Dwayne Viltz

August 16. 2010 05:02

drop ship suppliers

Hello there, Im at my business and was browsing around the cyberspace, goofing off, when I came over your web page. It¡¯s quite nicely implemented, and I certainly like your manner of publishing.

drop ship suppliers

August 16. 2010 15:56

piaip restaurant city

Thanks so much for your flawless post;this is the kind of thing that keeps me going through the day. I've been looking around for this site after asked to visit them from a buddy and was thrilled when I was able to find it after searching for some time. Being a demanding blogger, I'm dazzled to see others taking initivative and contributing to the community. I just wanted to comment to show my appreciation for your post as it's very energizing, and many writers do not get credit they deserve. I am sure I'll drop by again and will spread the word to my friends.

piaip restaurant city

August 16. 2010 23:08

iphone-accessories

No need to be gloomy guys, there's still a lot of positives to take.

iphone-accessories

August 17. 2010 23:16

dvd rip

Nice work. Keep posting.

dvd rip

August 18. 2010 05:19

Porter Cable Battery

Who admins of this place? I'd like to trade links.  Looking at the amount of hits that Yui.Net: The Tooltip gets and it'd be worth it for me to trade links.  Got to get ahead of the competition and all.  And, most of my traffic come from places just like here.

Porter Cable Battery

August 19. 2010 22:29

Broyhill Furniture

Thanks for this post,  it was great to read.

Broyhill Furniture

August 19. 2010 22:29

Broyhill Furniture

Thanks for this post,  it was great to read.

Broyhill Furniture

August 19. 2010 22:29

Broyhill Furniture

Thank you for this blog post,  it was great to read.

Broyhill Furniture

August 20. 2010 09:20

Merrill Shoes

Thank you for this blog post, It was a fantastic read which was extremely helpful.

Merrill Shoes

August 21. 2010 07:32

get seo

Hehey great post mate! I like the way you wrote it! I actually love reading your post, Anyways Have a Good Day ;)

get seo

August 21. 2010 15:15

Fat Loss

I think you have spent some time to give this amazing post to us. I don't know how to thank you.

Fat Loss

August 21. 2010 15:20

Fat Loss for Idiots Review

Many people will agree with your opinion whoever many other's will not agree,but I appreciate your work here.

Fat Loss for Idiots Review

August 22. 2010 16:28

Enriqueta Stensland

Great story! I have been looking for this information all around. This is was I looking for.

Enriqueta Stensland

August 22. 2010 16:36

Del Steenken

Good post! I have been looking for this information all around. This is was I looking for.

Del Steenken

August 22. 2010 17:28

gfx forum

Great post for us webmasters, thank you for posting it! Cheers!

gfx forum

August 22. 2010 17:28

gfx forums

Great post for us webmasters, thank you for posting it! Cheers!

gfx forums

August 22. 2010 17:34

Gregory Despain

Great post! I?m just starting out in community management/marketing media and trying to learn how to do it well - resources like this article are incredibly helpful. As our company is based in the US, it?s all a bit new to us. The example above is something that I worry about as well, how to show your own genuine enthusiasm and share the fact that your product is useful in that case

Gregory Despain

August 24. 2010 14:22

Janiece Klemencic

You can get a lot of incredibly nice points made here. Commonly, I am not very keen on weblogs. even so, every so often all of us need to take notice. Stimulating, I am grateful to you.

Janiece Klemencic

August 25. 2010 03:58

NFL Football Jerseys

If I speak in the Cheap Authentic NFL Jerseys tongues of men and of angels, but have not love, I am only a resounding gong or a clanging cymbal. If I have the gift of prophecy and can fathom all mysteries and all Official NFL Jerseys knowledge, and if I have a faith that can move mountains, but have not love, I am nothing. If I give all I possess to the poor and surrender my USA Jerseys Shop body to the flames,but have not love, I gain nothing.Love is patient, NFL Jerseys love is kind. It does not envy, it does not boast, it is not proud. It is not rude, it is not self-seeking, it is not easily angered, it NHL Jerseys keeps no record of wrongs. Love does not delight in evil but rejoices with the truth. It always protects, always trusts, always MLB Jerseys hopes, always perseveres.Love never NHL Hockey Jerseys fails. But where there are prophecies, they will cease; where there are tongues, they will be stilled; where there is knowledge, it will pass away. For we know in part and we prophesy in MLB Baseball Jerseys part, but when perfection comes, the imperfect disappea. When I was a child, I talked like a child, I thought like a child, I reasoned like a child. When I became NBA Basketball Jerseys man, I put childish ways behind me. Now we see but a poor reflection as in a mirror; then we shall see face to face. Now I know in part; then I shall know fully, even as I am fully known.And now these three remain: faith, hope and NFL Football Jerseys love. But the greatest of these is love. http://www.jersey-usa.com/sitemap.html LIJ

NFL Football Jerseys

August 25. 2010 11:02

Nicki Walts

High quality isn't an accident; it is usually the consequence of high objective, truthful work, clever direction and practiced execution; it symbolizes the wise number of many solutions.

Nicki Walts

August 27. 2010 10:25

karaoke players

I haven't visited a site this revealing in a while.  I will definately return!

karaoke players

August 27. 2010 12:26

botkier bags

I am speechless. This is a superb blog and very engaging too. Nice work! That's not really much coming from an amateur blogger like me, but it's all I could say after diving into your posts. Great grammar and vocabulary. Not like other blogs. You really know what you're talking about too. So much that you made me want to explore more. Your blog has become a stepping stone for me, my friend. Thank you for the articulate journey. I really enjoyed the 4 posts that I have read so far.

botkier bags

August 28. 2010 01:09

Galina Hamp

do you have an rss feed? I want to add it to my reader but I can't find it...

Galina Hamp

August 28. 2010 01:56

Khadijah Matyas

nice blog... why don't you post more?

Khadijah Matyas

August 29. 2010 03:02

Boris Burgener

are you using wp for this blog?

Boris Burgener

August 29. 2010 20:56

student driver magnet

Hi, I just ran across your weblog via Bing. Your article is truly applicable to my life right now, and I’m really pleased I found your website.

student driver magnet

August 29. 2010 20:58

student driver magnet

Great write-up, I am a big believer in writing comments on websites to help the blog writers know that they’ve added something worthwhile to the world wide web!

student driver magnet

August 30. 2010 07:06

dating affiliates

you may make some money if you add an affiliate program to your blog...

dating affiliates

August 30. 2010 18:41

bail bonds

I have read a few of the articles on your website now, and I really like your style of blogging. I added it to my favorites blog site list and will be checking back soon. Please check out my site as well and let me know what you think.

bail bonds

August 30. 2010 18:42

bail bonds baltimore

I hope you never stop!  This is one of the best blogs Ive ever read.  Youve got some mad skill here, man.  I just hope that you dont lose your style because youre definitely one of the coolest bloggers out there.  Please keep it up because the internet needs someone like you spreading the word.

bail bonds baltimore

August 31. 2010 00:05

payroll services

Heya this is a superb article. I'm going to e-mail this to my pals. I stumbled on this while searching on aol I'll be sure to come back. thanks for sharing.

payroll services

August 31. 2010 00:06

payroll services

Youre so awesome, man!  I cant believe I missed this blog for so long.  Its just great stuff all round.  Your design, man...too amazing!  I cant wait to read what youve got next.  I love everything that youre saying and want more, more, MORE!  Keep this up, man!  Its just too good.

payroll services

August 31. 2010 02:45

Melvin Fauntleroy

are you using a custom template?

Melvin Fauntleroy

August 31. 2010 12:21

Driving Schools Ringwood

Wicked keep this up champion.

Driving Schools Ringwood

August 31. 2010 15:38

blonde joke

nice blog! keep the good work!

blonde joke

August 31. 2010 20:31

refurbished garmin gps

Hello, I'm a college English student and I'm learning a great deal about writing by viewing blogs. I really enjoy your style of writing. It's simple to understand but with excellent details. Your choice of words makes it easy to read and understand. That's a huge segment of writing. Your viewers have to be able to understand what you're conveying to them and it has to be interesting. You need to engage your readers, so they will come back again. You do a great job with all of these aspects. Thx!

refurbished garmin gps

September 1. 2010 01:17

learn to type

Great post! Looking for a typing tutor? Check out my website.

learn to type

September 1. 2010 03:02

Petunia Picklebottom

I hope you never stop!  This is one of the best blogs Ive ever read.  Youve got some mad skill here, man.  I just hope that you dont lose your style because youre definitely one of the coolest bloggers out there.  Please keep it up because the internet needs someone like you spreading the word.

Petunia Picklebottom

September 1. 2010 03:04

Baby Gifts, New Baby Gifts

pretty handy material, overall I think this is worthy of a bookmark, thanks

Baby Gifts, New Baby Gifts

September 1. 2010 03:14

computer repair st petersburg

How's it hanging,    I totally agree with your blog post. My companys Mac run so much easier with it done. It's unbelievable how much such a small thing can make such a big differance. In the begining I was uneasy about trying it out, but but thanks to your article my worries was put to bed. donkishire (germany for thanks)

computer repair st petersburg

September 1. 2010 03:17

computer repair st petersburg

How's a goin,    I completly coincide with your post. Mine and my friends Mac run so much easier with it on. It's unbelievable how much such a small task can make such a monumental differance. In the begining I was hesitant about trying it out, but thanks to your help my worries was put to bed. gracias

computer repair st petersburg

September 1. 2010 07:31

personal training book

don't spend all the day in front of your computer, go out, exercise, go to the gym twice a week...

personal training book

September 1. 2010 12:58

ETF newsletters

it will be great if you post more...

ETF newsletters

September 1. 2010 20:42

typing tutor online

I enjoyed reading your post! Learn to type faster with typing tutor online.

typing tutor online

September 2. 2010 16:46

Janel Duttweiler

i'm adding your blog rss feed so that i can see your new posts.  keep up the good work!

Janel Duttweiler

September 2. 2010 21:47

cheap jerseys`

Great article, I think you covered everything there. . . I would say freelancing is quite hard especially if you are not used to working on your own, can be quite hard to motivate yourself also. . . we all know what it is like to stare at the monitor.

cheap jerseys`

September 3. 2010 12:00

New Day Homes for Sale

Great blog, keeping me from working

New Day Homes for Sale

September 3. 2010 15:13

Justin Fortes

nice post. thanks for your shareing. i amost agree what you write. but i think some place need expain more, then we can read clearly ,then it will help me easy understand it. at the all , thanks again for your shareing

Justin Fortes

September 3. 2010 21:31

seduction

do you have a xml feed for your blog?

seduction

September 3. 2010 21:32

mixed wrestling

Thanks for making the sincere effort to divulge this. I feel pretty strong about it and would like to learn more. If it's possible, as you learn more in depth knowledge, would you mind adding more articles similar to this one with more information? It would be so helpful and useful for me and my friends.

mixed wrestling

September 4. 2010 18:38

seduction

how old is this post?

seduction

September 5. 2010 07:42

Glutathione

Come on guys, let's keep it clean. This is a good blog. Good info mate.

Glutathione

September 6. 2010 03:41

ETF newsletters

just bookmarked your blog...

ETF newsletters

September 7. 2010 00:19

Japanese Tea Store

Uncover almost all the most effective anime right here

Japanese Tea Store

September 7. 2010 02:47

garden bridge

Ha, can't say you're wrong. Just need to get my head around this.

garden bridge

September 7. 2010 04:25

Carpet Cleaning Philadelphia

Fantastic blog article. Want more.

Carpet Cleaning Philadelphia

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading