-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
62 lines (51 loc) · 1.2 KB
/
index.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
$(document).ready(function(e){
$win = $(window);
$navbar = $('#header');
$toggle = $('.toggle-button');
var width = $navbar.width();
toggle__onclick($win,$navbar,width);
//resize event
$win.resize(function(){
toggle__onclick($win,$navbar,width);
});
$toggle.click(function(e){
$navbar.toggleClass("toggle-left");
});
});
function toggle__onclick($win, $navbar, width){
if($win.width()<=768){
$navbar.css({left:`-${width}px`});
}else{
$navbar.css({left:'0px'});
}
}
var typed = new Typed('#typed',{
strings: [
'Traveller',
'Foodie',
'Photographer',
'Software Engineer'
],
typeSpeed:50,
backSpeed:50,
loop: true
});
var typed_2 = new Typed('#typed_2',{
strings: [
'Traveller',
'Foodie',
'Photographer',
'Software Engineer'
],
typeSpeed:50,
backSpeed:50,
loop: true
});
document.querySelectorAll('a[href^="#"]').forEach(anchor=>{
anchor.addEventListener('click',function(e){
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior:'smooth'
});
});
});