Giter Site home page Giter Site logo

tiaanduplessis / wenk Goto Github PK

View Code? Open in Web Editor NEW
689.0 14.0 42.0 2.41 MB

:wink: Lightweight pure CSS tooltip for the greater good

Home Page: https://tiaanduplessis.github.io/wenk/

License: MIT License

CSS 74.67% JavaScript 25.33%
tooltip wenk css less scss stylus

wenk's Introduction

wenk

Lightweight pure CSS tooltip for the greater good


Table of Contents

About

Wenk is a Lightweight tooltip available in pure CSS, cssnext using PostCSS, Less or SCSS.

As Seen in

Why

  • It's Lightweight with the minified version being only 733 bytes when gzipped ๐Ÿ˜ฑ
  • It's easy to use
  • It's easy to customize
  • It's pure CSS
  • You're already here

Install

Install with cdn

<link rel="stylesheet" href="https://unpkg.com/wenk/dist/wenk.css">
<!-- Or -->
<link rel="stylesheet" href="https://cdn.rawgit.com/tiaanduplessis/wenk/master/dist/wenk.css">

Install with npm

$ npm install wenk

Install with yarn

$ yarn add wenk

Usage

wenk

Simply add the data-wenk attribute to your HTML with the text you want to display.

<span data-wenk="This is a tooltip!"></span>

You can display the tooltip at different positions using the data-wenk-pos attribute or the .wenk--* class. The default position is at the top.

<span data-wenk="I'm to the right!" data-wenk-pos="right">Wenk to the right!</span>
<span data-wenk="I'm to the left!" data-wenk-pos="left">Wenk to the left!</span>
<span data-wenk="I'm at the bottom!" data-wenk-pos="bottom">Wenk to the button!</span>
<!-- Or -->
<span class="wenk--right" data-wenk="I'm to the right!">Wenk to the right!</span>
<span class="wenk--left" data-wenk="I'm to the left!">Wenk to the left!</span>
<span class="wenk--bottom" data-wenk="I'm at the bottom!">Wenk to the button!</span>

The width of the tooltip can also easily be changed.

<span data-wenk="I'm small!" data-wenk-length="small">Small wenk!</span>
<span data-wenk="I'm medium!" data-wenk-length="medium">Medium wenk!</span>
<span data-wenk="I'm large!" data-wenk-length="large">Large wenk!</span>
<span data-wenk="I fit!" data-wenk-length="fit">I fit just right!</span>
<!-- Or -->
<span data-wenk="I'm small!" class="wenk-length--small">Small wenk!</span>
<span data-wenk="I'm medium!" class="wenk-length--large">Medium wenk!</span>
<span data-wenk="I'm large!" class="wenk-length--large">Large wenk!</span>
<span data-wenk="I fit!" class="wenk-length--fit">I fit just right!</span>

You can also align your text within the container

<p><span data-wenk="I'm right!" class="wenk-align--right">Wenk to the right!</span></p>
<p><span data-wenk="I'm center!" class="wenk-align--center">Wenk in the center!</span></p>

Demo

Check out the demo here.

Support

According to doiuse.com the following browsers are currently missing support:

  • IE (8,10)
  • Opera (12.1)
  • Opera Mini (5.0-8.0)
  • IE Mobile (10)

Contributing

All Contributions are welcome! Please open up an issue if you would like to help out. ๐Ÿ˜„

License

Licensed under the MIT License.

wenk's People

Contributors

abriginets avatar ayesh avatar greenkeeper[bot] avatar imgbotapp avatar jackmcpickle avatar panstav avatar purtuga avatar tiaanduplessis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wenk's Issues

Wenk should close on mouse over

  1. Hover over an element with a wenk tooltip
  2. Move the mouse from the element onto the wenk tooltip
  3. The wenk tooltip stays visible

Expected: Tooltip closes/gets hidden.

Create a message loop

Hello everyone, first of all congratulations for the work. Really enjoyed.
Actually, it's not an issue, it's a question, I'm trying to create a messaging loop but without success so far. Can you help me ?

Is fit working?

Hi there!

It's great to have alternatives for css tooltips, and this wenk looks a good one ๐Ÿ‘

So, the first step to know a new component is to open the demo site, and see how it works. But I guess something is wrong with the fit option, which in my opinion should be the default option. I don't recall seeing any tooltips with blank spaces.

And after hovering it, this was the result:

fit

It is saying that it fits, but it doesn't.

I'm testing using Chrome 53.

Best regards,
Rafael Pacheco.

Inline HTML

Hi! Great work! Would it possible to add a feature to allow for inline HTML? Thanks!

Scss files

Are you open to add scss src files to? Or do you feel it's better in a separate repo?

Stop propagation for underlying elements

When you use a wenk tooltip on a mobile device and the user wants to close it by clicking on it, and if there is an underlying element, the underlying element receives the click.

If the underlying element is a link, the user gets directed to the link.

Expected behavior: Tooltip should close.

How to fix this?



I hoped I could use Javascript, but as it seems, clicks on :before and :after elements cannot be caught: https://stackoverflow.com/q/7478336/1066234

Browser support?

Hi,

Can you please mention the supported browsers & especially IE versions? Better to add those details in README for 'greater good'

Thanks.

Question: How do I word wrap long text?

Hi,

This is a very cool implementation. I've got some long tooltips but could not figure out how to wrap the longer lines of text. Any suggestions would be greatly appreciated.

Thanks,

Karl

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.