-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjavascripts.js
More file actions
64 lines (49 loc) · 1.31 KB
/
Copy pathjavascripts.js
File metadata and controls
64 lines (49 loc) · 1.31 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* Using jQuery */
(function($) {
$(window).bind('resize', function(e)
{
if (window.RT) clearTimeout(window.RT);
window.RT = setTimeout(function()
{
this.location.reload(false); /* false to get page from cache */
}, 100);
});
// $('#myModal').on('shown.bs.modal', function () {
// $('#myInput').focus()
// })
// Init ScrollMagic
var ctrl = new ScrollMagic.Controller({
globalSceneOptions: {
triggerHook: 'onLeave'
}
});
ctrl.scrollTo(function(target) {
TweenMax.to(window, 0.7, {
scrollTo : {
y : target, // scroll position of the target along y axis
autoKill : true // allows user to kill scroll action smoothly
},
ease : Cubic.easeInOut
});
});
$(document).on("click", "a[href^=#]", function(e) {
var id = $(this).attr("href");
if($(id).length > 0) {
e.preventDefault();
// trigger scroll
ctrl.scrollTo(id);
// If supported by the browser we can also update the URL
if (window.history && window.history.pushState) {
history.pushState("", document.title, id);
}
}
});
// Create scene
$("section").each(function() {
new ScrollMagic.Scene({
triggerElement: this
})
.setPin(this)
.addTo(ctrl);
});
})(jQuery);