Skip to content
Snippets Groups Projects
Commit ba72dce1 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

fixed TOC-Bug and moved TOC behaviour to page.js FS#2314

parent bedfa6ab
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,6 @@ var dw_behaviour = {
dw_behaviour.removeHighlightOnClick();
dw_behaviour.quickSelect();
dw_behaviour.checkWindowsShares();
dw_behaviour.initTocToggle();
dw_behaviour.subscription();
dw_behaviour.revisionBoxHandler();
......@@ -86,36 +85,6 @@ var dw_behaviour = {
});
},
/**
* Adds the toggle switch to the TOC
*/
initTocToggle: function() {
var $header = jQuery('#toc__header');
if(!$header.length) return;
var $toc = jQuery('#toc__inside');
var $clicky = jQuery(document.createElement('span'))
.attr('id','toc__toggle')
.css('cursor','pointer')
.click(function(){
$toc.slideToggle(200);
setClicky();
});
$header.prepend($clicky);
var setClicky = function(){
if($toc.css('display') == 'none'){
$clicky.html('<span>+</span>');
$clicky[0].className = 'toc_open';
}else{
$clicky.html('<span>&minus;</span>');
$clicky[0].className = 'toc_close';
}
};
setClicky();
},
/**
* Hide list subscription style if target is a page
*
......
......@@ -10,6 +10,7 @@ dw_page = {
init: function(){
dw_page.sectionHighlight();
jQuery('a.fn_top').mouseover(dw_page.footnoteDisplay);
dw_page.initTocToggle();
},
/**
......@@ -93,7 +94,38 @@ dw_page = {
// now put the content into the wrapper
$fndiv.html(content);
$fndiv.show();
},
/**
* Adds the toggle switch to the TOC
*/
initTocToggle: function() {
var $header = jQuery('#toc__header');
if(!$header.length) return;
var $toc = jQuery('#toc__inside');
var setClicky = function(){
if($toc.css('display') == 'none'){
$clicky.html('<span>+</span>');
$clicky[0].className = 'toc_open';
}else{
$clicky.html('<span>&minus;</span>');
$clicky[0].className = 'toc_close';
}
};
var $clicky = jQuery(document.createElement('span'))
.attr('id','toc__toggle')
$header.css('cursor','pointer')
.click(function(){
$toc.slideToggle(200,setClicky);
})
.prepend($clicky);
setClicky();
}
};
jQuery(dw_page.init);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment