{"url":"https://api.github.com/gists/1854471","forks_url":"https://api.github.com/gists/1854471/forks","commits_url":"https://api.github.com/gists/1854471/commits","id":"1854471","node_id":"MDQ6R2lzdDE4NTQ0NzE=","git_pull_url":"https://gist.github.com/1854471.git","git_push_url":"https://gist.github.com/1854471.git","html_url":"https://gist.github.com/mbostock/1854471","files":{"index.html":{"filename":"index.html","type":"text/html","language":"HTML","raw_url":"https://gist.githubusercontent.com/mbostock/1854471/raw/4c9799efc9a3fefb657a7b279cbe1d29234fe75e/index.html","size":1479,"truncated":false,"content":"<!DOCTYPE html>\n<meta charset=\"utf-8\">\n<style>\n\nbody {\n  border: solid 3px steelblue;\n}\n\n#parent {\n  cursor: crosshair;\n  border: solid 7px steelblue;\n  position: relative;\n  margin: 29px auto;\n  padding: 31px;\n  width: 800px;\n  height: 400px;\n  background: #eee;\n}\n\n#child {\n  position: absolute;\n  border: solid 13px steelblue;\n  margin: 17px;\n  padding: 23px;\n  top: 100px;\n  left: 100px;\n  width: 200px;\n  height: 100px;\n  background: #ccc;\n}\n\n#circle {\n  position: absolute;\n  pointer-events: none;\n  border-radius: 12px;\n  margin-left: -12px;\n  margin-top: -12px;\n  width: 24px;\n  height: 24px;\n  background: red;\n}\n\n#small-circle {\n  position: absolute;\n  pointer-events: none;\n  background: black;\n  border-radius: 6px;\n  top: 12px;\n  left: 12px;\n  margin-left: -4px;\n  margin-top: -4px;\n  width: 8px;\n  height: 8px;\n}\n\n</style>\n\n<div id=\"parent\">\n  <div id=\"offset\"></div>\n  <div id=\"child\">\n    <div id=\"circle\">\n      <div id=\"small-circle\"></div>\n    </div>\n  </div>\n</div>\n\n<script src=\"//d3js.org/d3.v3.min.js\"></script>\n<script>\n\nd3.select(\"#child\").on(\"mousemove\", function() {\n  var ox, oy;\n\n  if (\"offsetX\" in d3.event) {\n    ox = d3.event.offsetX - this.clientLeft;\n    oy = d3.event.offsetY - this.clientTop;\n  } else {\n    ox = d3.event.layerX - this.clientLeft;\n    oy = d3.event.layerY - this.clientTop;\n  }\n\n  d3.select(\"#offset\").text(ox + \",\" + oy);\n\n  d3.select(\"#circle\")\n      .style(\"left\", ox + \"px\")\n      .style(\"top\", oy + \"px\");\n});\n\n</script>\n","encoding":"utf-8"},"thumbnail.png":{"filename":"thumbnail.png","type":"image/png","language":null,"raw_url":"https://gist.githubusercontent.com/mbostock/1854471/raw/6eb437ff25cf828f017a8516ce7555ffe40e6c10/thumbnail.png","size":1286,"truncated":false,"content":"iVBORw0KGgoAAAANSUhEUgAAAOYAAAB4CAYAAADmBo6IAAAAGXRFWHRTb2Z0\nd2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABKhJREFUeNrs3c1rHGUAx/Hf\nvCazcbd5aawrUqXYSlOQ3qSXBr0oHjwI3jwUrwX/AP8Bi9Crp14KLfTaW+NJ\naqEUSk5Bm6YKAcVQt3ZJ3OzLzDzjM5MqCLbswurOZr6fMmw37GF3dr55nmdb\n9vE//mrt0anmkZdNlsUCMFGe6wS//L7/2H/zlcbCl5++U+eUAOVw7fZW7HIa\ngPIhTIAwARAmQJgAxsUf9oGPdna12x3IdRzOGjCiLLOxeY5WXlvI/0lkfGF+\nvbah29/vECYwapR5aHZuunwk0rXP31MjCscXpmP/vHF0Th+efVWpyTjbwLDT\nUjtS3tlsqfXHoOhorFPZODVqzkf6bPWEBonhbANDCkNPO+2efm23xr/GzEtP\njFGnnxAmMIJ8hpnYY5RVIJ/KAiVEmABhAiBMgDABECZAmAAIEyBMAIQJgDAB\nwgRAmABhAiBMgDABECYAwgQIEwBhAoQJgDABwgRAmABewC/zk8u/Hzea8VXl\n3VLyzSi6/URsSkGY5RjKHUe9ONXN9e3itoqbGZks02zg6YO3m8Vtfh+EOdnR\n0nbYT4xu3N1Wez8eauuywyb/av35WqB3V44pCj0xbBJmaaayNTuVjdNMrg2z\nH5tKXJv5654JXBkbZq3iU3nCLPM6y9YYeo5WT9QV+o4O84wunykMkkx3t/fV\nTRkiCbPka63Ahvn+W3XVZ107xTu8b4jnSns9o/s/d9VhTUmYZZ/b5ddoz645\n/cHB2isLQxl7OGmqzPPkDgZy7KEp/5DI/v4pXmfRJHNYwpwmeZR+q6Xm1aua\n29hQ58wZ7Vy4oMHychEoQJj/d5R2dPT29nTq4kXVHjwofvbS+rrq9+5p88oV\npfV6MYoC02zq/udPPn2NtraKKL+198/bI7+tPXyopVu3ZKKIdxWEOZEl57MR\n8Td7fGePx3+9mG6XdxRMZScSZZKof/y44qUlffLkiTr5aGmPpNFQe3WVNSYY\nMSfyhONY/WZTP126pP3Tp1Wza8r89sfLl9U9efLgk1mAEXMCcfb72j13Tj9c\nvy6/3VYyP1+sPZnKghFz0k+81ytu48XFf9wHGDEnzRg5xvAughETAGEChAmA\nMAEQJkCYAAgTIEwAhAkQJgDCBECYAGECIEyAMAEQJkCYAAgTAGEChAmAMAHC\nBPCfmY6vr8wOtr2c9V1F4eHfuDYxz7b5ZN9awiz1sG6v0jjNtLa5V5mt3vPX\n6zrsXEuYZb9Y7YX6jQ2zCoNInuNM4IouCbO0enFaHJ7r/H3RVkHfvuZ8S/uZ\nmI8BCLNcy8oixrOvL6jTS+S61Rs+jA1zbtYvzgPLTcIszUUZhZ6++Gil8m/S\nIDHF+QBhluqiBKqGBQxAmAAIEyBMAIQJECYAwgQIEwBhAiBMgDABECZAmAAI\nEyBMAIQJgDABwgRAmABhAiBMgDABECYAwgQIEwBhAoQJgDABwgRAmAAIEyBM\nAIQJECYAwgQIEwBhAvj3MNNsuAemWabUcMKAUTmOZEymxAwXm7Gt+QuR99T+\nNUgSEz/vgb7varHmKw5snLZOYygUGFaSOmpEno41Qpk0UWZcO8hlz2nND2qB\n8/RPAQYAQ/VfQO+grd0AAAAASUVORK5CYII=\n","encoding":"base64"}},"public":false,"created_at":"2012-02-17T17:23:58Z","updated_at":"2016-02-09T01:15:05Z","description":"offsetX / offsetY","comments":0,"user":null,"comments_enabled":true,"comments_url":"https://api.github.com/gists/1854471/comments","owner":{"login":"mbostock","id":230541,"node_id":"MDQ6VXNlcjIzMDU0MQ==","avatar_url":"https://avatars.githubusercontent.com/u/230541?v=4","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","user_view_type":"public","site_admin":false},"forks":[{"url":"https://api.github.com/gists/1854606","user":{"login":"jasondavies","id":31223,"node_id":"MDQ6VXNlcjMxMjIz","avatar_url":"https://avatars.githubusercontent.com/u/31223?v=4","gravatar_id":"","url":"https://api.github.com/users/jasondavies","html_url":"https://github.com/jasondavies","followers_url":"https://api.github.com/users/jasondavies/followers","following_url":"https://api.github.com/users/jasondavies/following{/other_user}","gists_url":"https://api.github.com/users/jasondavies/gists{/gist_id}","starred_url":"https://api.github.com/users/jasondavies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasondavies/subscriptions","organizations_url":"https://api.github.com/users/jasondavies/orgs","repos_url":"https://api.github.com/users/jasondavies/repos","events_url":"https://api.github.com/users/jasondavies/events{/privacy}","received_events_url":"https://api.github.com/users/jasondavies/received_events","type":"User","user_view_type":"public","site_admin":false,"name":"Jason Davies","company":null,"blog":"https://www.jasondavies.com/","location":"London, UK","email":"jason@jasondavies.com","hireable":null,"bio":null,"twitter_username":"jasondavies","public_repos":22,"public_gists":76,"followers":3259,"following":37,"created_at":"2008-10-27T12:15:54Z","updated_at":"2026-04-03T18:54:42Z"},"id":"1854606","created_at":"2012-02-17T17:51:52Z","updated_at":"2015-09-30T20:08:38Z"}],"history":[{"user":{"login":"mbostock","id":230541,"node_id":"MDQ6VXNlcjIzMDU0MQ==","avatar_url":"https://avatars.githubusercontent.com/u/230541?v=4","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","user_view_type":"public","site_admin":false},"version":"a52765fd8b0d65c09bba3a24e41f9ae4e7f27a8c","committed_at":"2016-02-09T01:15:03Z","change_status":{"total":2,"additions":1,"deletions":1},"url":"https://api.github.com/gists/1854471/a52765fd8b0d65c09bba3a24e41f9ae4e7f27a8c"},{"user":{"login":"mbostock","id":230541,"node_id":"MDQ6VXNlcjIzMDU0MQ==","avatar_url":"https://avatars.githubusercontent.com/u/230541?v=4","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","user_view_type":"public","site_admin":false},"version":"93edd47a751f0f996c25a6f39861c5ca39d0bdc1","committed_at":"2012-10-12T03:51:30Z","change_status":{"total":0,"additions":0,"deletions":0},"url":"https://api.github.com/gists/1854471/93edd47a751f0f996c25a6f39861c5ca39d0bdc1"},{"user":{"login":"mbostock","id":230541,"node_id":"MDQ6VXNlcjIzMDU0MQ==","avatar_url":"https://avatars.githubusercontent.com/u/230541?v=4","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","user_view_type":"public","site_admin":false},"version":"57797834ae4b3b27f5823b903acfd6bec92f855e","committed_at":"2012-02-17T17:23:58Z","change_status":{"total":88,"additions":88,"deletions":0},"url":"https://api.github.com/gists/1854471/57797834ae4b3b27f5823b903acfd6bec92f855e"}],"truncated":false}