made with esnextbin
Last active
July 13, 2016 08:11
-
-
Save n1ru4l/50192089ed61985f85809f9e2a5a7ba8 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
<style> | |
html, | |
body { | |
overflow-x: hidden; | |
overflow-y: auto; | |
} | |
.nigga { | |
height: 20px; | |
width: 100%; | |
background-color: black; | |
margin-bottom: 400px; | |
color: white; | |
} | |
</style> | |
</head> | |
<body> | |
<label for="number">ZU welchem wilschst scrolle digga?</label><input id="number"><button id="send">Scroll digga</button> | |
<div class="nigga">1</div> | |
<div class="nigga">2</div> | |
<div class="nigga">3</div> | |
<div class="nigga">4</div> | |
<div class="nigga">5</div> | |
<div class="nigga">6</div> | |
<div class="nigga">7</div> | |
<div class="nigga">8</div> | |
<div class="nigga">9</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program | |
import $ from 'jquery' | |
$(document).ready(() => { | |
$('#send').click(() => { | |
let number = parseInt($('#number').val(), 10) | |
let $el = $(".nigga").eq(number) | |
$('body, html').stop().animate({ | |
scrollTop: $el.offset().top - $el.outerHeight(true) | |
}, 2000) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "jesus-christ", | |
"version": "0.0.0", | |
"dependencies": { | |
"jquery": "3.1.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _jquery = require('jquery'); | |
var _jquery2 = _interopRequireDefault(_jquery); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
(0, _jquery2.default)(document).ready(function () { | |
(0, _jquery2.default)('#send').click(function () { | |
var number = parseInt((0, _jquery2.default)('#number').val(), 10); | |
var $el = (0, _jquery2.default)(".nigga").eq(number); | |
(0, _jquery2.default)('body, html').stop().animate({ | |
scrollTop: $el.offset().top - $el.outerHeight(true) | |
}, 2000); | |
}); | |
}); // write ES2015 code and import modules from npm | |
// and then press "Execute" to run your program |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment