npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bullseye

v1.5.0

Published

Attach elements onto their target

Downloads

14,645

Readme

bullseye

Attach elements onto their target

Install

npm install bullseye --save
bower install bullseye --save

bullseye(el, target?, options?)

Position el according to the current position of target. In order to play well with friends, bullseye won't change the position CSS property, but instead leaves it up to you to set the appropriate position value on el. This way, we don't make it hard for you to set a different position value when you need to.

Option | Description --------------------|---------------------------------------------------------------------------------------------------------------------- caret | When true, the tracked position will be right below the text selection caret instead of below the entire target element tracking | When not false, window resize events will update the position for el autoupdateToCaret | Set to false if you don't want automatic position updates when caret is set to true context | Set to a DOM element if you want height readings to be relative to that element plus its height

When you call bullseye(el, target?, options?), you'll get back a tiny API to interact with the instance.

If target isn't provided, it'll match el. Bullseye supports operator overloading.

bullseye(el)
bullseye(el, options)
bullseye(el, target)
bullseye(el, target, options)

.refresh()

Refreshes position of el according to the current position of target.

.read()

Returns the current position in { x, y } format. Note that these values will be slightly modified in .refresh(), so it's not 100% 1-to-1.

.sleep()

When caret is true, it becomes computationally expensive to figure out the position whenever a key is pressed. For that reason, you can put bullseye to sleep on blur events and wake it up on focus, calling .refresh(). This isn't done automatically for you to give you finer-grained control.

.destroy()

Removes the resize event listener. Note that further calls to .refresh will throw exceptions.

License

MIT