forked from jgthms/marksheet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.js
More file actions
54 lines (48 loc) · 1.18 KB
/
Copy pathpost.js
File metadata and controls
54 lines (48 loc) · 1.18 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
jQuery(document).ready(function ($) {
var $breadcrumb = $('#breadcrumb');
var $toc = $('#menu');
var $list = $toc.children('ul');
var $headings = $('.content h3');
var $open = $('#open');
var $close = $('#close, #overlay');
if ($headings.length) {
$headings.each(function() {
var $el = $(this);
var id = $el.attr('id');
if (id) {
$list.append(
$('<li />').append(
$('<a />')
.text($el.text())
.attr('href', '#' + id)
)
);
$el.prepend(
$('<a />')
.addClass('header-link')
.attr('href', '#' + id)
.html('#')
);
return;
}
});
} else {
$toc.hide();
}
$breadcrumb.affix({
offset: {
top: $breadcrumb.offset().top,
bottom: function () {
var newsletterHeight = $('#newsletter').outerHeight(true);
var footerHeight = $('#footer').outerHeight(true);
return (this.bottom = newsletterHeight + footerHeight);
}
}
})
$open.click( function() {
$('html').addClass('has-menu-open');
});
$close.click( function() {
$('html').removeClass('has-menu-open');
});
});