-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathscripts.js
More file actions
42 lines (42 loc) · 1.11 KB
/
scripts.js
File metadata and controls
42 lines (42 loc) · 1.11 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
// For the mobile-phone layout (navbar {side bar})
var navLinks = document.getElementById("navLinks");
function showmenu() {
navLinks.style.right = "20px";
navLinks.style.top = "20px";
navLinks.style.display = block;
}
function hidemenu() {
navLinks.style.right = "20px";
navLinks.style.top = "-10000px";
navLinks.style.display = none;
}
// For the scroll Menu active part code:
$(document).ready(function (e) {
$("a[href*=\\#]").bind("click", function (e) {
e.preventDefault();
var target = $(this).attr("href");
$("html, body")
.stop()
.animate(
{
scrollTop: $(target).offset().top,
},
1000,
function () {
location.hash = target;
}
);
return false;
});
});
$(window)
.scroll(function () {
var scrollDistance = $(window).scrollTop();
$(".page-section").each(function (i) {
if ($(this).position().top <= scrollDistance) {
$(".navigation a.active").removeClass("active");
$(".navigation a").eq(i).addClass("active");
}
});
})
.scroll();