diff --git a/examples/custom-controls.html b/examples/custom-controls.html index 0d6cdf6d84..5e5cfb4050 100644 --- a/examples/custom-controls.html +++ b/examples/custom-controls.html @@ -10,39 +10,12 @@ ol3 custom controls example diff --git a/examples/custom-controls.js b/examples/custom-controls.js index 8181ecafc2..3da26b4805 100644 --- a/examples/custom-controls.js +++ b/examples/custom-controls.js @@ -29,23 +29,20 @@ app.RotateNorthControl = function(opt_options) { var options = opt_options || {}; - var anchor = document.createElement('a'); - anchor.href = '#rotate-north'; - anchor.innerHTML = 'N'; + var button = document.createElement('button'); + button.innerHTML = 'N'; var this_ = this; var handleRotateNorth = function(e) { - // prevent #rotate-north anchor from getting appended to the url - e.preventDefault(); this_.getMap().getView().setRotation(0); }; - anchor.addEventListener('click', handleRotateNorth, false); - anchor.addEventListener('touchstart', handleRotateNorth, false); + button.addEventListener('click', handleRotateNorth, false); + button.addEventListener('touchstart', handleRotateNorth, false); var element = document.createElement('div'); - element.className = 'rotate-north ol-unselectable'; - element.appendChild(anchor); + element.className = 'rotate-north ol-unselectable ol-control'; + element.appendChild(button); ol.control.Control.call(this, { element: element,