blob: a7f8b2fa4497719644d9d8866f203ec453a1a6f0 (
plain)
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
|
'use strict';
// back-to-top
$(document).ready((function (_this) {
return function () {
let bt
bt = $('#back_to_top')
if ($(document).width() > 480) {
$(window).scroll(function () {
let st
st = $(window).scrollTop()
if (st > 30) {
return bt.css('display', 'block')
} else {
return bt.css('display', 'none')
}
})
return bt.click(function () {
$('body,html').animate({
scrollTop: 0,
}, 800)
return false
})
}
}
})(this))
// nav-toggle
$(document).ready((function (_this) {
return function () {
let nav,icon
icon = $('#menu_icon')
nav = $('#site_nav')
icon.click(function () {
nav.slideToggle(250)
})
}
})(this))
// fancybox
$(document).ready((function (_this) {
return function() {
if ($.fancybox) {
$('.post_content').each(function() {
$(this).find('img').each(function() {
$(this).wrap(`<div class="fancybox"><a href="${this.src}" data-fancybox="gallery" data-caption="${this.title}"></a></div>`);
});
});
}
};
})(this))
|