Skip to content

Instantly share code, notes, and snippets.

@letiantian
Last active November 18, 2015 02:37
Show Gist options
  • Save letiantian/803a559216f556bcaf5d to your computer and use it in GitHub Desktop.
Save letiantian/803a559216f556bcaf5d to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}
<html>
<head>
</head>
<body>
</body>
</html>
function addElement() {
var div = document.createElement('div');
div.setAttribute('class', 'mydiv');
div.setAttribute('id', 'fixed-div');
div.style["background"] = "#222 none repeat scroll 0 0";
div.style["bottom"] = "45px";
div.style["cursor"] = "pointer";
div.style["height"] = "15px";
div.style["line-height"] = "0";
div.style["padding"] = "5px";
div.style["position"] = "fixed";
div.style["right"] = "50px";
div.style["width"] = "15px";
div.style["z-index"] = "1050";
div.onclick = function() {alert("hi");}
document.body.appendChild(div);
}
addElement();
{"view":"split-vertical","fontsize":"90","seethrough":"","prefixfree":"1","page":"javascript"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment