O'Reilly logo

Programming Atlas by Christian Wenz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Components

An Atlas component is encapsulated JavaScript that is not bound to HTML elements on a page, but stands alone. An Atlas component aggregates a set of JavaScript functionality to provide a single interface for use in code. A behavior is a bit limited in use, so a component can offer more functionality. Atlas comes with several components, most of them in the area of data controls (as you will see in Chapter 9), but here we will cover one component that is very usable in the real world and actually quite common on web pages: a pop-up component.

Using the Pop-Up Component

In this section we implement some pop-up functionality for our tabbed page. First of all, you need to create a component. The underlying mechanism—Sys.UI.PopupBehavior—is a behavior, but one without a visual representation. That’s why pop-up functionality is regarded as a component in Atlas, despite the fact that there is also a behavior of that name. (The Atlas documentation uses both the terms behavior and component for pop-up.) You can think of pop-up as a behavior that is triggered by the user or by JavaScript, but then uses a component to create a new visual representation. The pop-up component just allows you to show and hide a pop-up, but you must define the pop-up yourself; it is not built in as part of the behavior or component (that’s why it fits in both categories).

Implementing the pop-up requires you to complete the following steps:

  1. Define the pop-up in HTML as an element to display ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required