[
https://issues.apache.org/jira/browse/CB-10744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15174812#comment-15174812
]
ASF GitHub Bot commented on CB-10744:
-------------------------------------
Github user nikhilkh commented on a diff in the pull request:
https://github.com/apache/cordova-docs/pull/526#discussion_r54666977
--- Diff: www/static/js/index.js ---
@@ -145,17 +145,48 @@ $(document).ready(function () {
// Smooth scroll to anchor links
$("a[href^='#']").on('click', function(e) {
- if(this.hash) {
+
+ // scroll only if there is a hash in the href
+ var hash = this.hash;
+ if (hash) {
// prevent default anchor click behavior
e.preventDefault();
- // store hash
- var hash = this.hash;
+ // get the fragment without the "#" symbol
+ var targetName = hash;
+ if (targetName[0] === "#") {
+ var targetName = targetName.slice(1);
--- End diff --
We should not re-define targetName with a `var`
> Fragment links in docs don't work in many cases
> -----------------------------------------------
>
> Key: CB-10744
> URL: https://issues.apache.org/jira/browse/CB-10744
> Project: Apache Cordova
> Issue Type: Bug
> Components: Docs
> Reporter: Dmitry Blotsky
> Assignee: Dmitry Blotsky
> Priority: Minor
>
> Cases that don't work:
> - using {{name="X"}} for fragment anchors
> - using special characters in IDs
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]