-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
84 lines (66 loc) · 1.98 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
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
$(function(){
menu = $('nav ul');
$('#toggle-btn').on('click', function(e){
e.preventDefault();
menu.slideToggle();
});
$(window).resize(function(){
var w = $(this).width();
if (w > 580 && menu.is(':hidden')){
menu.removeAttr('style');
}
});
$('nav li').on('click', function(e){
var w = $(window).width();
if (w< 580) {
menu.slideToggle();
}
});
});
$('open-menu').height($(window).height());
// Smooth scrolling
$('a[href*="#"]')
.not('[href="#"]')
.not('[href="#0"]')
.click(function (event){
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname)
{ var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length){
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function (){
var $target = $(target);
$target.focus();
if($target.is(":focus")){
return false;
} else{
$target.attr('tabindex', '-1');
$target.focus();
}
});
}
}
});
function date(){
const today = new Date();
let s = today.getSeconds();
let h = today.getHours();
let m = today.getMinutes();
let mm = today.getMilliseconds();
// zero padding
s = zeroPad(s);
h = zeroPad(h);
m = zeroPad(m);
mm = zeroPad(mm);
const showDate = document.getElementById('txt');
showDate.innerHTML = "<h2>" +"Current Time:" + h + ":" + m +":" + s +": " + mm + "</h2>";
const u = setTimeout('date()', 0);
}
function zeroPad(number){
if (number < 10){
number = "0"+number;
}
return number;
}