-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
26 lines (24 loc) · 825 Bytes
/
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
$(function() {
$(".scroll").on('click', function(e) {
var target = $(e.currentTarget).attr('href');
if(target === "#") {
target = "#header-wrapper";
}
$("html,body").animate({scrollTop:$(target).offset().top-50}, "500");
});
var topofDiv = $("#header-wrapper").offset().top; //gets offset of header
var height = $("#header-wrapper").outerHeight(); //gets height of header
$(window).scroll(function(){
console.log($(window).scrollTop() / height);
if($(window).scrollTop() / height > 0.33) {
$("#transparent").addClass('opaque');
$("#logo").show();
$("#transparent").removeClass('transparent');
}
else{
$("#transparent").removeClass('opaque');
$("#logo").hide();
$("#transparent").addClass('transparent');
}
});
})