Repository navigation
Expand file tree
/
Copy pathzmain.js
More file actions
76 lines (65 loc) · 2.08 KB
/
Copy pathzmain.js
File metadata and controls
76 lines (65 loc) · 2.08 KB
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
(function( $, window, undefined ) {
// Menu
$("a#slide").click(function(){
$("#sidebar,a#slide,#fade").addClass("slide");
$("#open").hide();
$("#search").hide();
$("#close").show();
});
$("#fade").click(function(){
$("#sidebar,a#slide,#fade").removeClass("slide");
$("#open").show();
$("#search").show();
$("#close").hide();
});
// Search
var bs = {
close: $(".icon-remove-sign"),
searchform: $(".search-form"),
canvas: $("body"),
dothis: $('.dosearch')
};
bs.dothis.on('click', function() {
$('.search-wrapper').toggleClass('active');
bs.searchform.toggleClass('active');
bs.searchform.find('input').focus();
bs.canvas.toggleClass('search-overlay');
$('.search-field').simpleJekyllSearch();
});
function close_search() {
$('.search-wrapper').toggleClass('active');
bs.searchform.toggleClass('active');
bs.canvas.removeClass('search-overlay');
}
bs.close.on('click', close_search);
// Closing menu with ESC
document.addEventListener('keyup', function(e){
if(e.keyCode == 27 && $('.search-overlay').length) {
close_search();
}
});
if (document.getElementsByClassName('home').length >=1 ) {
new AnimOnScroll( document.getElementById( 'grid' ), {
minDuration : 0.4,
maxDuration : 0.7,
viewportFactor : 0.2
} );
}
smoothScroll.init({
selectorHeader: '.bar-header', // Selector for fixed headers (must be a valid CSS selector)
speed: 500, // Integer. How fast to complete the scroll in milliseconds
updateURL: false, // Boolean. Whether or not to update the URL with the anchor hash on scroll
});
function scrollBanner() {
var scrollPos;
var headerText = document.querySelector('.header-post .content')
scrollPos = window.scrollY;
if (scrollPos <= 500 && headerText != null) {
headerText.style.transform = "translateY(" + (-scrollPos/3) +"px" + ")";
headerText.style.opacity = 1-(scrollPos/500);
}
}
if (screen.width > 1024) {
window.addEventListener('scroll', scrollBanner);
}
})( Zepto, window );