https://github.com/capjamesg/hovercard.js

A script to load cards when you hover over a link in an article.

https://github.com/capjamesg/hovercard.js

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

hovercard javascript
Last synced: 7 months ago · JSON representation

Repository

A script to load cards when you hover over a link in an article.

Basic Info
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
hovercard javascript
Created over 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.md

hovercard.js

A script to load cards when you hover over a link in an article.

Example

Text in an article with an active hovercard that contains an image, a title, and a description

Getting Started

The hovercard.js script searches for all <a> tags enclosed within an <article> tag on a web page. Mouse hover and focus listeners are added to each link. When the mouse hovers over a link, hovercard.js looks for the href value of the link in a JSON object called hovercards. If the link is found in the JSON object, a hovercard is added directly below the link on the page.

When a user hovers off the link or moves focus onto another element (i.e. by using the keyboard to navigate links on the page), the hovercard will disappear.

Here are a few articles with hovercards:

  • https://jamesg.blog/2023/04/02/timehop-for-blogs/
  • https://jamesg.blog/2023/05/06/llms-open-source/
  • https://jamesg.blog/2023/05/19/airport-pianos/

Usage

To use the hovercard script, first download a copy and upload it to your site. Then, add this code above the closing </body> tag on your web page:

html <script src="./path/to/hovercard.js"></script>

Substitute the path of the script in the example above with the location of the script on your site.

You should add a JSON object to every page that contains a hovercard. This JSON object should use the following structure:

json { "https://example.com": { "title": "Example Domain", "description": "This domain is used for examples." "photo": "https://example.com/example.png" } }

Keys in the JSON object represent links on the page to look up. The only required key value is title. If a description and/or photo are provided, these will be included in the hovercard.

License

This code for this project is placed in the public domain.

Contributors

  • capjamesg

Owner

  • Name: James
  • Login: capjamesg
  • Kind: user
  • Location: Scotland
  • Company: @Roboflow

from words, wonder.

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Ikun886-cxk (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels