Cross Browser More Info Control

So, I had quite a few senarios where I needed to display information that took up a whole lot of real estate, but was only needed for a short period of time. Sort of a "hover help" kinda thing. I googled it for a while, and really wanted a "pure css" solution, but after realizing how much "fussing" with it that was needed for it to actually work in IE6 (even IE7 requires a strict doctype to get the hover pseudo element to work properly on non anchor elements), I decided to just go with a JS solution.

I also decided that this was functionality that really should be encapsulated and hopefully eventually added to our SmartControl for the display of BOD help etc. I wanted the control to take any valid HTML markup and only display it if certain conditions where met. I also wanted the control to be totally themeable and skinnable, with a very simple API and generate SEO and standards friendly HTML.

I attached the Class diagram for the control I wrote.

MoreInfo control

By default the BehaviorType is set to OnMouseOver so content will show when a user hovers over the icon. 

I've added a default skin (that uses the Info icon) as well as a Help skin.

To use the the help Icon, you'd simply set the SkinId to "Help". 

The example below would show a Info icon that would show the HTML included when the user RightClicked on it.

<asiweb:InfoControl runat="server" BehaviorType="OnRightClick">
<h3>More Info Control</h3>
<p>This control will be shown when a user right clicks on the Info Icon</p>
</asiweb:InfoControl>

Here's an example of using it programatically

InfoControl infoControl = new InfoControl();
infoControl.BehaviorType = InfoControlShowBehaviorType.OnClick;
infoControl.Text = SomeHelpText;
infoControl.SkinID = "Help";
InfoPlaceHolder.Controls.Add(infoControl);

Thanks to Jeremy for Reviewing the code and giving me some great ideas!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Does the text time out?

One problem people have with hover text, especially with long ones, is that the text goes away before they are finished reading it. Does this text stay up indefinitely?

Also, I'd like to see it in action. Can you tell me where it is used, or post an example?

No, the text doesn't time out.

The behavior you're most likely mentioning is setting the title or attribute on elements. The "timeout" is the behavior of the browser.

This control uses custom JS and CSS to create the behavior. In "OnMouseOver" mode (default), the more info content will not dissapear until the user mouses out of the content and the actual help icon.

I think I'm saying that it behaves exactly the way you hope! :)