Giter Site home page Giter Site logo

cara-tm / simple-tooltips Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 34 KB

:speech_balloon: Simple javascript and CSS tooltips with no dependencies, use of aria-label with full fallback for old browsers. :v:

Home Page: https://codepen.io/cara-tm/full/ERybMd/

License: MIT License

JavaScript 16.49% HTML 52.74% CSS 30.77%
javascript tooltip no-dependencies css3 all-browsers fallbacks gracefully

simple-tooltips's Introduction

Simple JS Tooltips

Simple and very light javascript tooltips with no dependencies, uses the "aria-label" attribute with full fallback for old browsers. ๐Ÿค˜

Usage

Simply add a tooltip class to your links. The script transferts the content of the title attributes into aria-label ones and do not affect old browsers which keep showing the default tooltip mode.

Limitations and browser bugs noticed

  • Edge browser (and old WebKit engines) underlines the tooltips content for links with a "text-decoration" rule (without possible corrections): https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13140617/.
  • Edge browser shrinks tooltips with links surrounding long sentences. Solution: reduice the links length.
  • For links with a table-cell or table-row display, the tooltips are shown full width (according to their parents). Solution: change the tooltip's display and width properties (ex. .parent .link [class^=tooltip]:after {display: table;min-width: auto}).
  • Some old Webkit engine browsers keep tooltips text content underlined. The only solution consists to apply the CSS property text-decoration: none onto the links.

RTL languages

The CSS file provided adapts the position of little arrow for right to left reading languages (based on the <html dir=""> tag).

Demos

See in action this: online demo here

Updated version: online demo here

simple-tooltips's People

Contributors

cara-tm avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.