jump.js icon indicating copy to clipboard operation
jump.js copied to clipboard

Check if element exists

Open egoist opened this issue 8 years ago • 2 comments

egoist avatar Dec 16 '16 10:12 egoist

Any chance of seeing this PR merged? @callmecavs

espehel avatar Jan 30 '18 15:01 espehel

@espehel probably not as is - the PR includes a bunch of other changes that go against the code style, etc.

it's easy enough to implement this outside the library, as follows:

const target = document.querySelector('selector')

if (!target) {
  // handle invalid target here
  return
} else {
  jump(target, { duration: 1000 })
}

the check might also need to be a bit more complete - like test for instanceof HTMLElement or something along those lines

callmecavs avatar Jan 30 '18 16:01 callmecavs