From 399d5a28fd9294076c2411979d8cb489c667ca15 Mon Sep 17 00:00:00 2001 From: Ethan B Martin Date: Wed, 18 Feb 2015 22:00:25 +0000 Subject: [PATCH] bug fix for named anchors that start with "." such as those made for docstrap. Should also help with https://github.com/jgallen23/toc/issues/16 if I'm reading that bug correctly --- lib/toc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/toc.js b/lib/toc.js index 378259f..841ffa6 100644 --- a/lib/toc.js +++ b/lib/toc.js @@ -12,7 +12,7 @@ $.fn.toc = function(options) { var scrollTo = function(e, callback) { if (opts.smoothScrolling && typeof opts.smoothScrolling === 'function') { e.preventDefault(); - var elScrollTo = $(e.target).attr('href'); + var elScrollTo = $(e.target).attr('href').replace('#.', '#\\.'); opts.smoothScrolling(elScrollTo, opts, callback); }