O'Reilly logo

YUI 2.8 Learning the Library by Dan Wellman, Daniel Barreiro

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 the ContextMenu

Let's move on to take a look at another menu type—the context, or right-click menu. The navigation menu on our portfolio site provides links to three different image pages. We can use one of these pages to showcase a series of thumbnail images and add right-click functionality to each thumbnail image.

We'll take the page that we used with the Container family controls to show a full view and rate the images and replace that ugly Rate! button with a ContextMenu with even more options.

ContextMenu scripting

Our custom ContextMenu can be created entirely programmatically, without building on existing markup (except for the images of course), making the context menu very easy and quick to implement.

The following screenshot shows ...

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