-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (22 loc) · 739 Bytes
/
app.js
File metadata and controls
26 lines (22 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$(document).ready(function () {
$('.fake').height($('.container').height());
for (var i = 0; i < $('section').length; i++) {
$('.nav').append('<a rel="' + i + '">' + i + '</a>');
}
$('.nav').on('click', function (e) {
if ($(e.target).prop('tagName').toLowerCase() == 'a') {
var index = $(e.target).attr('rel');
var scrollTo = $('section').outerHeight() * index;
$('.container').css({
'transform': 'translate3d(0,-' + ($('section').height() * index) + 'px, 1px)'
});
$(window).scrollTop(scrollTo);
}
});
$(window).scroll(function (e) {
var pos = $(e.target).scrollTop();
$('.container').css({
'transform': 'translate3d(0,-' + pos + 'px, 1px)'
});
});
});