Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E819719BE0 for ; Wed, 2 Mar 2016 01:36:18 +0000 (UTC) Received: (qmail 52424 invoked by uid 500); 2 Mar 2016 01:36:18 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 52364 invoked by uid 500); 2 Mar 2016 01:36:18 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 51908 invoked by uid 99); 2 Mar 2016 01:36:18 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Mar 2016 01:36:18 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 4B5132C1F58 for ; Wed, 2 Mar 2016 01:36:18 +0000 (UTC) Date: Wed, 2 Mar 2016 01:36:18 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-10744) Fragment links in docs don't work in many cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org