-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
97 lines (88 loc) · 2.57 KB
/
main.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
$(function(){
function responsive() {
WinHeight = $(window).height();
WinWidth = $(window).width();
SliderImgHeight = $('.top-it').height();
SliderHeight = $('#myCarousel').height();
$('.main').css({'margin-top' : SliderHeight});
if(WinWidth < 768) {
$('#menues').removeClass('in');
} else {
$('#menues').addClass('in');
}
if(WinWidth > 1450) {
$('.top-it').css({'top' : -(SliderImgHeight - WinHeight*0.8 - 200)})
} else {
$('.top-it').css({'top' : 0})
}
}
responsive();
$(window).resize(function() {
responsive();
})
$('a').on('click', function(e) {
if($(this).attr('href') == '#') {
e.preventDefault();
}
})
$('.toggler-menu').on('click', function(e) {
$('nav').addClass('fixed-nav');
e.preventDefault();
})
$('#roll-more').on('click',function(e) {
e.preventDefault();
if($(this).html() == 'Show more models') {
$(this).html('Show less models');
$('.glyphicon-chevron-down').css({'transform' : 'rotate(180deg) translate(0px, -5px)'});
} else {
$(this).html('Show more models');
$('.glyphicon-chevron-down').css({'transform' : 'rotate(0deg) translate(0px, 0px)'});
}
});
function scroll() {
var CarHeight = $('.carousel').outerHeight();
var rollIns = $('#roll-ins').offset().top;
var FadeUp = $('#fade-up').offset().top;
var sc = $(window).scrollTop();
var Csc = sc/2;
// var windowFadeTop = $('.window-scrl-fade').offset().top;
$('#myCarousel').css({'top' : -Csc});
if(sc >= CarHeight) {
$('nav').addClass('fixed-nav');
// var opacity = (sc + 500 - windowFadeTop) / (sc / 6);
// $('.window-scrl-fade').css({'opacity' : opacity});
} else {
$('nav').removeClass('fixed-nav');
}
if (sc >= (FadeUp - ($(window).height() - 200))) {
$('#fade-up').addClass('fade-up');
} else {
$('#fade-up').removeClass('fade-up');
}
if(sc > rollIns - ($(window).height() - 200)) {
$('.roll-img1').each(function(i) {
setTimeout(function() {
$('.roll-img1').eq(i).addClass('rolled-in');
}, 150 * (i+1));
});
} else {
$('.roll-img1').each(function(i) {
setTimeout(function() {
$('.roll-img1').eq(i).removeClass('rolled-in');
}, 150 * (i+1));
});
}
}
$(window).scroll(function() {
scroll();
})
scroll();
})
function responsive1() {
var CarHeight = $('.carousel').outerHeight();
$("nav").attr('data-offset-top', CarHeight);
}
$(window).resize(function() {
responsive1();
})
responsive1();