44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
jQuery(function($) {
|
|
var toc = $("#toc ul");
|
|
|
|
|
|
|
|
jQuery("#toc a.toggle").click(function(){
|
|
toc.toggle();
|
|
if(toc.is(":visible")){
|
|
jQuery("#body").css("margin-right", 280);
|
|
jQuery("#body h1").css("margin-right", 0);
|
|
}else{
|
|
jQuery("#body").css("margin-right", 20);
|
|
jQuery("#body h1").css("margin-right", 250);
|
|
}
|
|
|
|
});
|
|
|
|
|
|
$("#body :header").each(function() {
|
|
|
|
var h = $(this);
|
|
var name = h.text().replace(/[\s,-;\.]/g, "");
|
|
|
|
h.before( $("<a/>" , {name: name}) );
|
|
|
|
var li = $("<li class='" + this.tagName + "'></li>");
|
|
var ahref = $("<a/>", {href: "#" + name} ).append( h.text().replace(/\s/g, " ") );
|
|
|
|
li.append(ahref);
|
|
toc.append(li);
|
|
});
|
|
|
|
/*
|
|
var parent = toc.parent(),
|
|
tocOverlay = parent
|
|
.clone()
|
|
.insertBefore(parent)
|
|
.css({
|
|
overflow: "visible",
|
|
position: "absolute",
|
|
right: "10px",
|
|
}).hide();
|
|
*/
|
|
}); |