/
scripts.js
52 lines (41 loc) · 1.61 KB
/
scripts.js
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
// -----------------------------------------------------------Toggle menu between scrollable and fixed
var watcher = scrollMonitor.create( '#menu' );
watcher.lock();
watcher.stateChange(function() {
$('#menu').toggleClass('fixed', ($(window).scrollTop() - this.top >= 0))
});
// -----------------------------------------------------------Trigger sidebar slide-ins
var watcher = scrollMonitor.create( 'div.one' );
watcher.stateChange(function() {
$('div.one').toggleClass('trigger-left', this.isInViewport)
});
var watcher = scrollMonitor.create( 'div.two' );
watcher.stateChange(function() {
$('div.two').toggleClass('trigger-right', this.isInViewport)
});
var watcher = scrollMonitor.create( 'div.three' );
watcher.stateChange(function() {
$('div.three').toggleClass('trigger-left', this.isInViewport)
});
var watcher = scrollMonitor.create( 'div.four' );
watcher.stateChange(function() {
$('div.four').toggleClass('trigger-right', this.isInViewport)
});
var watcher = scrollMonitor.create( 'div.five' );
watcher.stateChange(function() {
$('div.five').toggleClass('trigger-left', this.isInViewport)
});
var watcher = scrollMonitor.create( 'div.six' );
watcher.stateChange(function() {
$('div.six').toggleClass('trigger-right', this.isInViewport)
});
// -----------------------------------------------------------Parallax scrolling
function parallax(){
var scrolled = $(window).scrollTop();
$('.frontend-bg').css('top', -(scrolled * 0.2) + 'px');
// $('.manager-bg').css('top', -(scrolled * 0.2) + 'px');
// $('.me-bg').css('top', -(scrolled * 0.2) + 'px');
}
$(window).scroll(function(e){
parallax();
});