Skip to content

Instantly share code, notes, and snippets.

@njx
Created April 5, 2013 22:35
Show Gist options
  • Save njx/5323236 to your computer and use it in GitHub Desktop.
Save njx/5323236 to your computer and use it in GitHub Desktop.
scroll issue (not a CM bug as it turns out)
<!doctype html>
<html>
<head>
<title>Scroller issue</title>
<link rel="stylesheet" href="lib/codemirror.css">
<script src="lib/codemirror.js"></script>
<link rel="stylesheet" href="doc/docs.css">
<style type="text/css">
.CodeMirror {border: 1px solid black; height: auto;}
.CodeMirror-lines { padding: 15px 0; }
/* our bug was that we were also setting padding on .CodeMirror-gutters */
</style>
</head>
<body>
<h1>Scroller issue</h1>
<div id="editor"></div>
<script id="script">
window.onload = function() {
var content = "line 0\nline 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\nline 10";
var editor = CodeMirror(document.getElementById("editor"), {
lineNumbers: true,
value: content
});
editor.getScrollerElement().style.minHeight = "100px";
editor.refresh();
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment