-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.js
43 lines (40 loc) · 1.22 KB
/
menu.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
(function($) {
$(function() {
var $article = $('.article');
var $header = $('.header');
// Nav Fixed
$(window).scroll(function() {
if ($(window).scrollTop() > 350) {
$article.addClass('fixed');
$article.addClass('fixed');
} else {
$header.removeClass('fixed');
$header.removeClass('fixed');
}
});
// Nav Toggle Button
$('#nav-toggle').click(function(){
$article.toggleClass('open');
});
$('.tab_content').click(function(){
$article.removeClass('open');
});
$('#nav-toggle').click(function(){
$header.toggleClass('open');
});
$('.tab_content').click(function(){
$header.removeClass('open');
});
});
})(jQuery);
$(function(){
$('a[href^="#"]').click(function() {
var adjust = 0;
var speed = 1200;
var href= $(this).attr("href");
var target = $(href == "#" || href == "" ? 'html' : href);
var position = target.offset().top + adjust;
$('body,html').animate({scrollTop:position}, speed, 'swing');
return false;
});
});