-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
51 lines (44 loc) · 1.59 KB
/
script.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
$(window).scroll(function(){
var top1 = $(".about").offset().top;
var position1 = top1 - $(window).height();
var top2 = $(".partners").offset().top;
var position2 = top2 - $(window).height();
var top3 = $(".members").offset().top;
var position3 = top3 - $(window).height();
var top4 = $(".contact").offset().top;
var position4 = top4 - $(window).height();
if($(window).scrollTop() > position1){
$('.list-about a').css('color', '#20d8ba');
$(".triangle").addClass("triangle-move");
$(".header-logo").addClass("header-logo-move");
}else{
$('.list-about a').css('color', '#404040');
$(".triangle").removeClass("triangle-move");
$(".header-logo").removeClass("header-logo-move");
}
if($(window).scrollTop() > position2){
$('.list-about a').css('color', '#404040');
$('.list-partners a').css('color', '#20d8ba');
}else{
$('.list-partners a').css('color', '#404040');
}
if($(window).scrollTop() > position3){
$('.list-partners a').css('color', '#404040');
$('.list-members a').css('color', '#20d8ba');
}else{
$('.list-members a').css('color', '#404040');
}
if($(window).scrollTop() > position4){
$('.list-members a').css('color', '#404040');
$('.list-contact a').css('color', '#20d8ba');
}else{
$('.list-contact a').css('color', '#404040');
}
});
$('header a').click(function(){
var id = $(this).attr('href');
var position = $(id).offset().top;
$('html, body').animate({
'scrollTop':position
},'slow');
});