Skip to content

Instantly share code, notes, and snippets.

@woosungchu
Created October 20, 2017 09:15
Show Gist options
  • Save woosungchu/5fe75c20dbc1ebb405296aa204c59efc to your computer and use it in GitHub Desktop.
Save woosungchu/5fe75c20dbc1ebb405296aa204c59efc to your computer and use it in GitHub Desktop.
function dfs(depth, x, y){
if(depth == 5)return false;
var div = document.createElement('div');
div.style.position = 'absolute';
div.style.left = (x + 100)+'px';
div.style.top = (y + 100)+'px';
div.style.width = (depth * 10)+'px';
div.style.height = (depth * 10)+'px';
div.style.padding = '10px';
div.style.background = '#eee';
document.body.appendChild(div);
dfs(depth+1,x,y);
console.log(depth,x,y);
}
document.onmousemove = function(e){
dfs(1,e.pageX,e.pageY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment