Tagged: table of contents
-
AuthorPosts
-
March 19, 2020 at 8:52 am #1194329
if i use chinese words on tag H1 H2,
the table of contents can’t catch H1 H2
but use english word is ok.
please fix that.
thanks.March 19, 2020 at 1:24 pm #1194414Hey Moaaaaya,
Where can we see and reproduce the problem you are having?
Best regards,
RikardMarch 20, 2020 at 4:16 am #1194669hello, here is the url .
March 23, 2020 at 3:24 am #1195331up up
March 24, 2020 at 2:32 pm #1196390Hi Moaaaaya,
Could you please attach some screenshots of the issue?
What do you mean by “the table of contents can’t catch H1 H2”? How do you need it to be?
Best regards,
VictoriaMarch 24, 2020 at 3:14 pm #1196407March 24, 2020 at 5:29 pm #1196921Hi Moaaaaya,
Thank you, but what really is the problem? Can you please explain a bit more?
Best regards,
VictoriaMarch 25, 2020 at 2:56 am #1197543hello,I think it’s should be p=382#標題
not
p=382#- This reply was modified 4 years, 9 months ago by Moaaaaya.
March 25, 2020 at 1:03 pm #1197663Hi,
I’m not sure if Chinese characters are supported in general to be honest with you: https://electrictoolbox.com/valid-characters-html-id-attribute/. Does it work if you try to link to it manually?
<a href="your.site/p=382#標題">Anchor link</a>
Best regards,
RikardMarch 26, 2020 at 3:06 am #1197908hello
i made link by manually
that looks ok.
so there have a problem on TABLE OF CONTENTS when h1,2,3,4,5 title is use chinese.
http://51.dr104.com.tw/?p=382- This reply was modified 4 years, 9 months ago by Moaaaaya.
March 28, 2020 at 11:26 pm #1198728Hi,
Sorry for the late reply, this function will add the text character to the url of the TOC so the anchor links will work, unfortunately this will only work if the whole TOC is Chinese, because it brakes the English links.
Try adding this code to the end of your functions.php file in Appearance > Editor:function custom_toc_script(){ ?> <script> (function($){ $(document).ready(function(){ $(".avia-toc-container a.avia-toc-link").each(function(){ var character = $(this).find("span").text(); $(this).attr('href', function() { return "#" + character; }); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_toc_script');
Please let us know if you want to use English and Chinese TOC’s on the same site, we can have this code only work on the pages to have the Chinese TOC.
Best regards,
MikeMarch 30, 2020 at 5:05 am #1198999hello,it’s not work.
I give you the Site ID & PASSWORD on private content.
you can take a look,thanks.March 30, 2020 at 12:13 pm #1199052Hi,
Thank you for the link, I see your site is getting the errorjQuery is not defined
and your theme options are not showing the option Enfold Theme Options > Performance > Load jQuery in your footer
This is a sign that your webhost has set your scripts to be loaded in the footer, which brakes the jQuery.
There are different scripts that your webhost can use to move the jQuery to the footer, please ask them to remove their code, probably in the “wp-config.php” file.Best regards,
MikeMarch 31, 2020 at 5:39 am #1199259jQuery is loaded
hello please have a check.
thanks.March 31, 2020 at 1:32 pm #1199317Hi,
Thank you for getting this option displayed, did they tell you how they had done it? We want it disabled so I did that for you. It seems the sidebar was loading after the script ran, so I added a delay to the script, now it’s working fine.
Please clear your browser cache and check.The final code:
function custom_toc_script(){ ?> <script> (function($){ $(document).ready(function(){ setTimeout(function () { $(".avia-toc-container a.avia-toc-link").each(function(){ var character = $(this).find("span").text(); $(this).attr('href', function() { return "#" + character; }); }); }, 2000); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_toc_script');
Best regards,
MikeApril 1, 2020 at 3:27 am #1199598thanks,but it’s not scroll when I press it.
April 3, 2020 at 1:27 pm #1200504Hi,
Sorry for the late reply, I see you are now getting the error “Cannot read property ‘top’ of undefined” when the links are clicked, it seems related to the language, for example when I copy the link I get this:
http://51.dr104.com.tw/?p=382#%E6%A8%99%E9%A1%8C%E4%B8%89
instead of:
http://51.dr104.com.tw/?p=382#標題三
Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.