[OpenLayers-Commits] r11377 - sandbox/crschmidt/pan-tap/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 24 03:47:34 EST 2011


Author: crschmidt
Date: 2011-02-24 00:47:34 -0800 (Thu, 24 Feb 2011)
New Revision: 11377

Modified:
   sandbox/crschmidt/pan-tap/examples/tap.html
Log:
Updates to the tap page to make it slightly easier
to use.


Modified: sandbox/crschmidt/pan-tap/examples/tap.html
===================================================================
--- sandbox/crschmidt/pan-tap/examples/tap.html	2011-02-23 23:00:17 UTC (rev 11376)
+++ sandbox/crschmidt/pan-tap/examples/tap.html	2011-02-24 08:47:34 UTC (rev 11377)
@@ -1,17 +1,18 @@
 <html>
 <body>
-<div id='data' style="float:right; width: 40%">
+<div id="foo" style="border: 2px solid black; width: 200px; height: 200px; position: absolute">
 </div>
-<div id="foo" style="border: 2px solid black; width: 40%; height: 200px">
+<div id='data' style="width: 200px">
 </div>
 
 <script>
+
   var foo = document.getElementById("foo");
   var events = ['mouseover', 'mouseout', 'click', 'scroll', 'mousedown', 'mouseup', 'mousemove'];
   var data = document.getElementById('data');
   var ul = document.createElement("ul");
   for (var i = 0; i < events.length; i++) {
-    var div = document.createElement("div");
+    var div = document.createElement("li");
     div.appendChild(document.createTextNode(events[i]+ ": "));
     var span = document.createElement("span");
     span.id = "data_"+  events[i];
@@ -21,6 +22,9 @@
         var ev = evt.type;
         var data = document.getElementById("data_" + ev);
         data.innerHTML = evt.clientX + ", "+ evt.clientY;
+        if (window.evt) {
+        data.innerHTML = window.evt.clientX + ", "+ window.evt.clientY;
+        }
     }
     if (navigator.userAgent.toLowerCase().indexOf("msie") == -1) {
         foo.addEventListener(events[i], func, null);
@@ -28,6 +32,25 @@
         foo.attachEvent("on"+events[i], func);
     }
   }
+  var li = document.createElement("li");
+  li.appendChild(document.createTextNode("Scroll: "));
+  var span = document.createElement("span");
+  span.id = "data_scroll";
+  ul.appendChild(li);
+  var li = document.createElement("li");
+  li.appendChild(document.createTextNode("Scroll: "));
+  var span = document.createElement("span");
+  span.id = "data_resize";
+  ul.appendChild(li);
+  var li = document.createElement("li");
+  li.appendChild(document.createTextNode("Scroll: "));
+  var span = document.createElement("span");
+  span.id = "data_zoom";
+  ul.appendChild(li);
+/*  window.addEventListener("scroll", function() { document.getElementById("data_scroll").innerHTML = Date.now(); }, null);
+  window.addEventListener("resize", function() { alert("resize"); document.getElementById("data_resize").innerHTML = Date.now(); }, null);
+  window.addEventListener("zoom", function() { alert("zoom"); document.getElementById("data_zoom").innerHTML = Date.now(); }, null);*/
+  ul.appendChild(li);
   data.appendChild(ul);
 </script>
 </body>



More information about the Commits mailing list