Code Monkey home page Code Monkey logo

anchor-scroll's People

Contributors

bdc-stripe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anchor-scroll's Issues

Missing hash produce error

Obviously more of a user error scenario here, but if you attempt to link to an ID that is not on the page, you get the following error: Uncaught TypeError: Cannot read property 'getBoundingClientRect' of null What do you think about not attempting to move anywhere at that point if you can't find the selector?

Also, I'd like to suggest adding a single # with no ID should scroll up to the top of the page as a native # would.

add to NPM

cant hurt - simple, focused modules such as this are often highly depended on

Add git tags

Hi @bendc ,
We are cdnjs team, and we want to host this library.
Could you please add git tags so that the git auto-updater in cdnjs project can recognize the correct version?
Thank you.

cdnjs/cdnjs#7817

Public Methods

Wanted to see how you felt about the ability to use public methods to call this library on arbitrary content that may not have a click handler associated with it.

AnchorScroll(document.querySelector('#my-content'));

mention ES6 in the README

Looks like the code is running through some kind of transpilation step, because the fat arrow functions are missing from the .min file, and the const declarations are converted to var. is it possible that the minifier is smart enough to remove them?

Anyways, the Map object and the Array.from method - both of which are part of the ES6 spec - make an appearance in the .min file. Perhaps this should be noted in the README?

Junk when scroll

Have a considerable junk on scrolling all the way down to the bottom of the page.

Breaks browser's back button

I found out that scrolling to an anchor works wonderfully, however breaking the browser's back button's functionality (Chromium, Firefox, Safari Mobile).
After commenting out the below, the back button works, however not scrolling smoothly.

I was trying onpopstate and different onpushstate variants to have it scroll smoothly to the top again, upon clicking the back button, but wasn't able to do so. If you have an idea, I'd appreciate it.

  const complete = (hash, coordinates) => {
    //history.pushState(null, null, hash);
    root.scrollTop = coordinates.get("start") + coordinates.get("delta");
  };

  const attachHandler = (links, index) => {
    const link = links.item(index);
    link.addEventListener("click", event => {
      //event.preventDefault();

      scroll(link);
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.