cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From riknoll <...@git.apache.org>
Subject [GitHub] cordova-docs pull request: CB-10744 Fixing fragment link handling
Date Thu, 03 Mar 2016 02:04:51 GMT
Github user riknoll commented on a diff in the pull request:

    https://github.com/apache/cordova-docs/pull/526#discussion_r54826548
  
    --- Diff: www/static/js/index.js ---
    @@ -145,17 +145,46 @@ $(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 because location.hash
    +            // is returned with it
    +            var targetName = targetName.slice(1);
    --- End diff --
    
    This line is a little confusing. Can you make the scoping of `targetName` clearer by renaming
the variable?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message