Skip to content

Commit

Permalink
Fixed #8: Fix show/hide nested behavior if TOC is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
gfranko committed Dec 7, 2012
1 parent 8443093 commit c06649b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion demos/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ <h3 class="headerDoc well"><a href="http://bonsaiden.github.com/JavaScript-Garde
<script>
$(function() {

window.toc = $("#toc").tocify({ selectors: "h2, h3, h4, h5" }).data("tocify");
$("#toc").tocify({ selectors: "h2, h3, h4, h5" }).data("tocify");

prettyPrint();
$(".optionName").popover({ trigger: "hover" });
Expand Down
47 changes: 22 additions & 25 deletions src/javascripts/jquery.tocify.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,47 +623,44 @@
// Stores the plugin context in the `self` variable
var self = this;

// If the sub-header is already hidden
if (elem.is(":visible")) {
//Determines what jQuery effect to use
switch (self.options.hideEffect) {

//Determines what jQuery effect to use
switch (self.options.hideEffect) {
// Uses `no effect`
case "none":

//Uses `no effect`
case "none":
elem.hide();

elem.hide();
break;

break;
// Uses the jQuery `hide` special effect
case "hide":

//Uses the jQuery `hide` special effect
case "hide":
elem.hide(self.options.hideEffectSpeed);

elem.hide(self.options.hideEffectSpeed);
break;

break;
// Uses the jQuery `slideUp` special effect
case "slideUp":

//Uses the jQuery `slideUp` special effect
case "slideUp":
elem.slideUp(self.options.hideEffectSpeed);

elem.slideUp(self.options.hideEffectSpeed);
break;

break;
// Uses the jQuery `fadeOut` special effect
case "fadeOut":

//Uses the jQuery `fadeOut` special effect
case "fadeOut":
elem.fadeOut(self.options.hideEffectSpeed);

elem.fadeOut(self.options.hideEffectSpeed);
break;

break;
// If none of the above options were passed, then a `jqueryUI hide effect` is expected
default:

//If none of the above options were passed, then a `jqueryUI hide effect` is expected
default:
elem.hide();

elem.hide();
break;

break;
}
}

// Maintains chainablity
Expand Down
4 changes: 2 additions & 2 deletions src/javascripts/jquery.tocify.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c06649b

Please sign in to comment.