jump.js
jump.js copied to clipboard
Check if element exists
Any chance of seeing this PR merged? @callmecavs
@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