-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
79 lines (68 loc) · 1.89 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//To Readmore
! function readMore() {
var winH = $(window).height();
const tabBox = $(".tab:visible");
var tabH = tabBox.height();
if (tabH > winH) {
tabBox.css({
"height": "500px",
"overflow": "hidden"
});
$("#btn_readMore").click(
function () {
$(".hide_box").remove();
tabBox.css({
"height": "auto",
"overflow": "block"
});
}
);
} else {
$(".hide_box").remove();
}
}();
// HideHeader
! function hideHeader() {
var didScroll;
var lastScrollTop = 0;
var delta = 5;
var navbarHeight = $("header").outerHeight();
$(window).scroll(function (event) {
didScroll = true;
});
setInterval(function () {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
function hasScrolled() {
var st = $(this).scrollTop();
// Make sure they scroll more than delta
if (Math.abs(lastScrollTop - st) <= delta)
return;
// If they scrolled down and are past the navbar, add class .nav-up.
// This is necessary so you never see what is "behind" the navbar.
if (st > lastScrollTop && st > navbarHeight) {
// Scroll Down
$("header").removeClass("nav-down").addClass("nav-up");
} else {
// Scroll Up
if (st + $(window).height() < $(document).height()) {
$("header").removeClass("nav-up").addClass("nav-down");
}
}
lastScrollTop = st;
}
}();
function playPause() {
var myVideo = document.querySelector('.daily-life-video');
myVideo.paused ? myVideo.play() : myVideo.pause();
}
function videoPlay() {
$('video').click(
function () {
$('video').play();
}
);
}