Chapter 6. Components and Behaviors

Handling events with script code or markup can be a practical way to create user experiences that are more interactive, but sometimes this approach just requires too much code. This is especially true when you wish to tie a specific action to a particular control, such as one that is a reaction to a user clicking or hovering over it. Fortunately, Atlas offers a viable alternative that will be covered in this chapter.

Two new concepts are introduced in this chapter: Atlas components and Atlas behaviors. Whereas Atlas behaviors contain JavaScript functionality and are always tied to HTML elements that are visible on the page, Atlas components (also consisting of JavaScript) might or might not have a graphical representation. One example of this is the Timer control, an instance of a component, which is not represented graphically on the page, as you’ll see when it is discussed in Chapter 1.

In this chapter, we will cover the behaviors and components that ship with Atlas and how to use them.

Using Behaviors

Atlas behaviors are similar to the behaviors introduced by Microsoft for Internet Explorer: you can attach a predefined Atlas behavior to an HTML element just as you can attach an Internet Explorer behavior. For instance, one behavior that ships with IE allows you to “do something when the mouse pointer hovers over an element,” such as a button, perhaps altering its color or font. The base Atlas library ships with the following behaviors:

  • Sys.UI.PopupBehavior ...

Get Programming Atlas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.