Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/javascripts/jquery.tocify.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@

self.extendPageScroll = true;

// Getting rid of possibly existing helper divs
$("[data-unique]").remove();

// Internal array that keeps track of all TOC items (Helps to recognize if there are duplicate TOC item strings)
self.items = [];

Expand Down Expand Up @@ -515,9 +518,12 @@
$self,

// Instantiates a new variable that will be used to determine the smoothScroll animation time duration
duration;
duration,

li = this.element.find("li");

// Event delegation that looks for any clicks on list item elements inside of the HTML element calling the plugin
this.element.off("click.tocify", "li");
this.element.on("click.tocify", "li", function(event) {

if(self.options.history) {
Expand Down Expand Up @@ -546,7 +552,9 @@
});

// Mouseenter and Mouseleave event handlers for the list item's within the HTML element calling the plugin
this.element.find("li").on({
li.off("mouseenter.tocify");
li.off("mouseleave.tocify");
li.on({

// Mouseenter event handler
"mouseenter.tocify": function() {
Expand Down Expand Up @@ -576,6 +584,7 @@
if (self.options.extendPage || self.options.highlightOnScroll || self.options.scrollHistory || self.options.showAndHideOnScroll)
{
// Window scroll event handler
$(window).off("scroll.tocify");
$(window).on("scroll.tocify", function() {

// Once all animations on the page are complete, this callback function will be called
Expand Down