html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script src="https://code.jquery.com/jquery-3.1.1.js"></script>
</head>
<body>
<div id="out">
<div id="in">
</div>
</div>
<p id="offset">offset:0</p>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#out {
background-color: blue;
width: 300px;
height:300px;
position: relative;
}
#in {
background-color: red;
width: 50px;
height:50px;
position:absolute;
top: 0px;
left: 100px;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
$(document).ready(
function() {
$('#out').on('click', function(e) {
$('#offset').text('offset: '+ e.offsetX)
})
}
);
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run