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

onhover-link-previews

v1.1.0

Published

A JS library to show screenshot previews of webpages when mouse is hovered on Links.

Downloads

11

Readme

OnHover Link Previews

Description

OnHover Link Preview is a lightweight JavaScript library (< 885 Bytes when loaded using CDN) that allows you to display image previews of links when hovered over. It's designed to be easy to use and highly customizable. The preview is fetched using the WordPress.com MShots service.

Installation

You can install the package from npm using the following command:

npm install onhover-link-previews

Usage

To use OnHover Link Preview JS Library, follow these steps:

1. Include the library in your project:

<script src="https://cdn.jsdelivr.net/npm/onhover-link-previews/index.min.js"></script>

2. Add the "onhover-link-preview" class to the links you want to enable the preview for:

<a href="https://example.com" class="onhover-link-preview"
  >Hover me for a preview!</a
>

3. Customize the preview image by adding width and height classes to the links:

<a href="https://example.com" class="onhover-link-preview olp-w-400 olp-h-300"
  >Custom-sized preview</a
>

You can set custom width and height for the preview image by adding width and height classes to the links. The library looks for classes in the format olp-w-{width} and olp-h-{height}, where {width} and {height} are numeric values. By default, if the classes are not present, the values of the width, and height are 300, and 200 respectively.

4. Styling

You can customize the styling of the preview box using CSS by applying styling to the ( .on-hover-link-prev ) div class. The default styles include:

position: absolute;
top: 30px;
left: 8px;
background-color: rgb(255, 255, 255);
padding: 10px;
box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 10px;
z-index: 9999;
max-width: 50%;

So, if you want to edit these default values for the ..on-hover-link-prev class, be sure to use the "!important". Other than these, you can add any other design to the preview box by selecting the class name.

Example:

.on-hover-link-prev {
  background-color: #f2f2f2 !important;
  padding: 15px !important;
  margin-right: 30px; //Will make the look awkward, but it's an example anyway :)
}

MShots Service

Please note that OnHover Link Preview relies on the external MShots service provided by Automattic. MShots (https://github.com/Automattic/mShots) is licensed under GPL2. For information regarding the privacy policy of Automattic, please refer to the official website

License

This library is licensed under the MIT License. See the LICENSE file for details.