cordova-dev mailing list archives

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

    https://github.com/apache/cordova-docs/pull/526#discussion_r54667932
  
    --- 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] === "#") {
    --- End diff --
    
    I guess the condition will never fail as long as browsers obey the standard. I'll remove
the check.


---
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