xiaoluoboding / ghost-theme-kaldorei

🎨 A Simple And Elegant Ghost Theme Derive From Default Theme Casper

Home Page:http://blog.xlbd.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors occurs when TOC contains special chars

xiongchengqing opened this issue · comments

it occurs errors when TOC contains special chars. jQuery selector treats selector string which contains special chars (*, -, ^, ?, etc) as invalid syntax. When it comes to rich text headings like some SQL select * from user VS select * from "user", the TOC anchor jumping will fail.

This is my solution for the issue.

var target = $(this).attr('href');

change to below

  var target = document.getElementById($(this).attr('href').split('#')[1]);

If anyone have a better solution, pls update it.

wx20170918-160632 2x

Thanks for fixed this bug.