[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX]: PluginAutoTOC: clicking on links should update URL with hash anchor
"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <695e8533239f1_2c334a144094e@gitlab-sidekiq-low-urgency-cpu-bound-v2-7dd748c866-lw5rl.mail> |
luci pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki
Commits:
1e54840c by Grace Nshokano at 2026-01-07T16:00:54+00:00
[BP][FIX]: PluginAutoTOC: clicking on links should update URL with hash anchor
---
* [FIX]: PluginAutoTOC: clicking on links should update URL with hash anchor
---
* [FIX] PluginAutoTOC: clicking on links should update URL with hash anchor
See merge request tikiwiki/tiki!9269
(cherry picked from commit 328b659dd919a303775ae90cf9a2968b0e393152)
See merge request tikiwiki/tiki!9319
- - - - -
1 changed file:
- lib/jquery_tiki/autoToc.js
Changes:
=====================================
lib/jquery_tiki/autoToc.js
=====================================
@@ -331,9 +331,18 @@ $(function () {
e.preventDefault();
var target = this.hash;
var $target = $(target);
- if (typeof parentNode !== 'undefined') {
- var parent = document.querySelector(target).parentNode;
- $('.tabs a[href="#'+parent.id+'"]').tab('show');
+
+ if ($target.length) {
+ if (typeof parentNode !== 'undefined') {
+ var parent = document.querySelector(target).parentNode;
+ $('.tabs a[href="#' + parent.id + '"]').tab('show');
+ }
+
+ $('html, body').stop().animate({
+ scrollTop: $target.offset().top
+ }, 900, function() {
+ window.location.hash = target;
+ });
}
$('html, body').stop().animate({
'scrollTop': $target.offset().top
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1e54840c1cafedd76014a00db29b2bba3bf2b7de
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/1e54840c1cafedd76014a00db29b2bba3bf2b7de
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs