-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
62 lines (49 loc) · 1.19 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
/*-----loading-----*/
$(window).on("load", function () {
$('html').css('overflow-y', 'auto');
$(".loading_wrapper").fadeOut("slow");
$("#bg").css('visibility', 'visible');
});
/*-----aos-----*/
AOS.init();
/*-----視差-----*/
var s = skrollr.init();
/*-----錨點-----*/
$(function () {
$('a[href*="#"]:not([href="#"])').click(function () {
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) {
$("html, body").animate({
scrollTop: target.offset().top
},
1000
);
return false;
}
}
});
});
/*-----返回頂端-----*/
$(function () {
/* 按下GoTop按鈕時的事件 */
$('#gotop').click(function () {
$('html,body').animate({
scrollTop: 0
}, 'slow');
return false;
});
/* 往下滑超過就讓GoTop按鈕出現 */
$(window).scroll(function () {
if ($(this).scrollTop() > 500) {
$('#gotop').fadeIn();
} else {
$('#gotop').fadeOut();
}
});
});