GithubHelp home page GithubHelp logo

davidmr001 / balloon.css Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kazzkiq/balloon.css

0.0 1.0 0.0 571 KB

Simple tooltips made of pure CSS

Home Page: https://kazzkiq.github.io/balloon.css/

License: MIT License

CSS 100.00%

balloon.css's Introduction

npm version

Simple tooltips made of pure CSS

Balloon.css lets you add tooltips to elements without JavaScript and in just a few lines of CSS.

Demo & Playground

You can play with Balloon.css here: https://jsfiddle.net/9fboea3u/

You also can check more examples at the website: http://kazzkiq.github.io/balloon.css/

Usage

Installation

Using npm:

npm install balloon-css

CDN version (provided by cdnjs):

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/balloon-css/0.2.4/balloon.min.css">

Manually: Simply download balloon.min.css from this repo and add it to your HTML. e.g.

<link rel="stylesheet" href="path/to/balloon.min.css">

Positioning

For positioning, use data-balloon-pos attribute with one of the values: up, down, left or right:

<button data-balloon="Whats up!" data-balloon-pos="up">Hover me!</button>
<button data-balloon="Whats up!" data-balloon-pos="left">Hover me!</button>
<button data-balloon="Whats up!" data-balloon-pos="right">Hover me!</button>
<button data-balloon="Whats up!" data-balloon-pos="down">Hover me!</button>

Showing tooltips programatically

If you want to show tooltips even when user interaction isn't happening, you can simply use the data-balloon-visible attribute:

<button data-balloon="Whats up!" data-balloon-pos="up" id="show-tip">Hover me!</button>
<script>
  const btn = document.getElementById('show-tip')
  btn.setAttribute('data-balloon-visible', '')
</script>

Glyphs and Icon Fonts

You can also add any HTML special character to your tooltips, or even use third-party Icon fonts:

<button data-balloon="HTML special characters: &#9787; &#9986; &#9820;" data-balloon-pos="up">Hover me!</button>
<button data-balloon="Emojis: ๐Ÿ˜€ ๐Ÿ˜ฌ ๐Ÿ˜ ๐Ÿ˜‚ ๐Ÿ˜ƒ ๐Ÿ˜„ ๐Ÿ˜… ๐Ÿ˜†" data-balloon-pos="up">Hover me!</button>

Example using Font Awesome:

<button class="fa" data-balloon="Font Awesome: &#xf030; &#xf133; &#xf1fc; &#xf03e; &#xf1f8;" data-balloon-pos="up">Hover me!</button>

Contributing

Balloon.css is mantained in SASS and LESS. To contribute with bugfixes and enchancements you must follow this steps:

  1. Clone repo. E.g. git clone https://github.com/kazzkiq/balloon.css.git
  2. Run npm install
  3. Edit SASS/LESS files and run npm run build-all to generate the production CSS files. (alternatively you can run build-sass or build-less for specific compiling).
  4. Make sure to test the production files over the website (branch gh-pages) before submitting a Pull Request.

Note 1: Remember to update both SASS and LESS files after your changes (both must always be in sync).

Note 2: You're not obligated to use the built-in tasks from the above steps. If you're using your own build, just make sure to update production and source files before submitting a PR.

Credits

Made by Claudio Holanda (@kazzkiq)

balloon.css's People

Contributors

kazzkiq avatar marcobiedermann avatar lukehaas avatar davesnx avatar ed1nh0 avatar josephdburdick avatar spasticninja avatar andreynering avatar anthony-redfox avatar philreinking avatar

Watchers

davidwei_001 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.