• Resolved samminhtuan

    (@samminhtuan)


    Hello,

    I am using the free version and want to know how to use Ninja Table with this javascript. I tried several times but it did not work. I do not have much knowledge about javascript.

    It is Javascript “Replacing anchor links with JavaScrip”
    Example: domain.com/url#anchor => domain.com/url when you click the link will not show #anchor in the address on the browser.

    <script type="text/javascript">
    
    window.addEventListener("DOMContentLoaded", function(e) {
      var links = document.getElementsByTagName("A");
      for(var i=0; i < links.length; i++) {
        if(!links[i].hash) continue;
        if(links[i].origin + links[i].pathname != self.location.href) continue;
        (function(anchorPoint) {
          links[i].addEventListener("click", function(e) {
            anchorPoint.scrollIntoView(true);
            e.preventDefault();
          }, false);
        })(document.getElementById(links[i].hash.replace(/#/, "")));
      }
    }, false);
    
    </script>

    Thank you!

    • This topic was modified 7 years, 7 months ago by samminhtuan.

The topic ‘My Javascript Not Working With Ninja Tables’ is closed to new replies.