Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Define a css class for delete button in openlayers?

        .olControlDelete {
     background-image: url("help.png"); 
     background-repeat:no-repeat;
     background-attachment:fixed;
     background-position:center;
     z-index:10;
      }

Or

  div.olControlDelete {
  top: 100px;
  left: 50px;
  position: absolute;
       }

  .olControlDelete div {
  background-image: url("edit_sprite.png");
  background-repeat: no-repeat;
  width:  22px;
  height: 22px;
  border: thin solid black;
  margin-top: 10px;
}

Don,t seem to work, Please help. Last question for openlayers. please

Below Code from Vadin:

                 deleteShape = new OpenLayers.Control.SelectFeature(
polygonLayer, 
{
    displayClass: "olControlDelete",
    title: deleteFeature,
    eventListeners: {
        featurehighlighted: function overlay_delete(event) {
            var feature = event.feature;
            if( confirm(strConfirmMessage) ) { // prompt
                polygonLayer.removeFeatures( [ feature ] );
                // TODO other clean up - remove popups or send some ajax to server.  Up to you....

            }
        }
    }   
} 
       );

            map.addControl(deleteShape);
share|improve this question
up vote 2 down vote accepted

My control lives inside the olControlEditingToolbar [the standard one, I just add more to it] and you have to set the class for when the button is Active and Inactive

.olControlEditingToolbar .olControlDeleteItemInactive {
  background-image: url("../images/edit/delete_off.png");
}
.olControlEditingToolbar .olControlDeleteItemActive {
  background-image: url("../images/edit/delete_on.png");
}

You really should be looking at examples on the OL site. OL has "ok" documentation, but is much better documented-by-example. OL Examples

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.