Book Image

OpenLayers 2.10 Beginner's Guide

Book Image

OpenLayers 2.10 Beginner's Guide

Overview of this book

Table of Contents (18 chapters)
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a custom button


You know a bit more about the Button class now, so let's put that knowledge to use. We'll create a fairly simple custom button (of control type TYPE_BUTTON) that will update the base layer's opacity and zoom the map to a random spot. We'll cover the few basic things that should be included when creating a button:

  • Specifying the button's displayClass to give it style (optional)

  • Creating a function and setting it as the trigger function

  • Adding the button a panel, and then adding that panel to a map