Sample code to render a slider outside the map viewport:
var slider = new GeoExt.LayerOpacitySlider({
renderTo: document.body,
width: 200,
layer: layer
});
Sample code to add a slider to a map panel:
var layer = new OpenLayers.Layer.WMS(
"Global Imagery",
"http://maps.opengeo.org/geowebcache/service/wms",
{layers: "bluemarble"}
);
var panel = new GeoExt.MapPanel({
renderTo: document.body,
height: 300,
width: 400,
map: {
controls: [new OpenLayers.Control.Navigation()]
},
layers: [layer],
extent: [-5, 35, 15, 55],
items: [{
xtype: "gx_opacityslider",
layer: layer,
aggressive: true,
vertical: true,
height: 100,
x: 10,
y: 20
}]
});
Configuration properties in addition to those listed for Ext.slider.SingleSlider.
Public methods in addition to those listed for Ext.slider.SingleSlider.
Parameter: | layer – OpenLayers.Layer or GeoExt.data.LayerRecord |
---|
Bind a new layer to the opacity slider.