After trying a lot of different options here is what I did to make it work. The original problem was that I wanted to assign different CSS to two different OpenLayers.Control.BUTTON objects but for some reason they were both getting the same CSS.
What I did was remove the script that created the buttons from inside the panelControls array. Now I create variables for both buttons, assign the appropriate attributes to each variable, and then add the variable for the buttons to the panelControls array.
Each button object also gets its own block of CSS assigned to it when it is declared. Now each button gets looks different! Here is the JavaScript I use;
var btnZoomToMaxExtent = new OpenLayers.Control.Button({ title: "MAX EXTENT",
id: 'btnZoomToMaxExtent',
displayClass: "btnZoomToMaxExtent",
trigger: zoomToExtent
}); //Calls the zoomToExtent function so that it only zooms out to the extent we tell it to instead of the map extent
var btnHiLite = new OpenLayers.Control.Button({ title: "Click once for hover info, click it again to turn off the functionality",
id: 'btnHiLite',
displayClass: "btnHiLite",
trigger: activateHiLite
});
var panelControls = [
new OpenLayers.Control.ZoomBox({title: "Draw a box to ZOOM IN"}),
new OpenLayers.Control.DragPan({title: "PAN"}),
new OpenLayers.Control.ZoomOut({title: "ZOOM OUT"}),
new OpenLayers.Control.ZoomIn({title: "ZOOM IN"}),
nav.previous, nav.next, btnZoomToMaxExtent, btnHiLite
];
and here is the CSS for both buttons. They both look similiar but have different images:
//THIS IS THE CSS FOR THE btnHiLite
.btnHiLiteItemInactive {
border-top: 1px solid #96d1f8;
background: #6ed665;
background: -webkit-gradient(linear, left top, left bottom, from(#3e9c50), to(#6ed665));
background: -webkit-linear-gradient(top, #3e9c50, #6ed665);
background: -moz-linear-gradient(top, #3e9c50, #6ed665);
background: -ms-linear-gradient(top, #3e9c50, #6ed665);
background: #6ed665 url('../../img/marker.png') no-repeat center;
padding: 5px 10px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: #9c494e;
font-size: 12px;
font-family: Georgia, serif;
text-decoration: none;
vertical-align: middle;
}
//THIS IS THE CSS FOR btnZoomToMaxExtent
.btnZoomToMaxExtentItemInActive {
border-top: 1px solid #96d1f8;
background: #6ed665;
background: -webkit-gradient(linear, left top, left bottom, from(#3e9c50), to(#6ed665));
background: -webkit-linear-gradient(top, #3e9c50, #6ed665);
background: -moz-linear-gradient(top, #3e9c50, #6ed665);
background: -ms-linear-gradient(top, #3e9c50, #6ed665);
background: #6ed665 url('../../Img/move_feature_off.png') no-repeat center;
padding: 5px 10px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color: #9c494e;
font-size: 12px;
font-family: Georgia, serif;
text-decoration: none;
vertical-align: middle;
}
Best Answer
i got the answer for my own question partially one month back but i forgot to post it here so that others can make use of it...... i have done the panzoombar changes using css it self with some changes javascript...........
- JAVASCRIPT
this code is slit lengthier one but it can be made simpler in more ways........
thanks for ur help peoples .....