Giter VIP home page Giter VIP logo

hopop.js's Introduction

Hopop.js

I made a librairy like Popper.js in order to train myself in javascript.

You can see an example here

as you can see, a popup appears when you move the mouse over an element

Usage

First, you need to download the JS and the CSS file then import them in your file.

<script  type="text/javascript"  src="hopop.js"></script>
<link  rel="stylesheet"  href="hopop.css">

Afterward you can select elements by its id or class (the first argument) and then pass a function that will return the content (HTML) of the future popup.

You also can add a position for the popup (top, right, bottom, left).

See the examples below :

// add popup on element that have "class" as class and the popup contains its description dataset
hopop(".class", function(element) {
	return  "Description :" + element.dataset.description;
});
// add popup on element that have "id" as id and the popup contains its description dataset
hopop("#id", function(element) {
	return  "Description :" + element.dataset.description;
}, "top");

You can of course put what you want in the popup's content like images for example

Plus if you want to change the design of the popup you can edit the CSS directly, the base code is really simple

hopop.js's People

Contributors

namysh avatar

Stargazers

 avatar  avatar Rudy David 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.