GithubHelp home page GithubHelp logo

renowncoder / jbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stephanwagner/jbox

0.0 0.0 0.0 4.26 MB

jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.

Home Page: https://stephanwagner.me/jBox

License: MIT License

HTML 0.25% JavaScript 85.26% SCSS 14.50%

jbox's Introduction

jBox

jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.

Demo: https://stephanwagner.me/jBox

Docs: https://stephanwagner.me/jBox/documentation


Install

ES6

npm install --save jbox
import jBox from 'jbox';
import 'jbox/dist/jBox.all.css';

CDN

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/StephanWagner/[email protected]/dist/jBox.all.min.js"></script>
<link href="https://cdn.jsdelivr.net/gh/StephanWagner/[email protected]/dist/jBox.all.min.css" rel="stylesheet">

Tooltips

Create a new instance of jBox Tooltip and attach it to elements:

new jBox('Tooltip', {
  attach: '.tooltip'
});

Now elements with class="tooltip" will open tooltips:

<span class="tooltip" title="My first tooltip">Hover me!</span>
<span class="tooltip" title="My second tooltip">Hover me!</span>

Modal windows

You can set up modal windows the same way as tooltips. But most of times you'd want more variety, like a title or HTML content:

new jBox('Modal', {
  width: 300,
  height: 200,
  attach: '#myModal',
  title: 'My Modal Window',
  content: '<i>Hello there!</i>'
});
<div id="myModal">Click me to open a modal window!</div>

Confirm windows

Confirm windows are modal windows which requires the user to confirm a click action on an element. Give an element the attribute data-confirm to attach it:

new jBox('Confirm', {
  confirmButton: 'Do it!',
  cancelButton: 'Nope'
});
<div onclick="alert('Yay! You did it!')" data-confirm="Do you really want to do this?">Click me!</div>
<a href="https://stephanwagner.me/jBox" data-confirm="Do you really want to leave this page?">Click me!</a>

Notices

A notice will open automatically and destroy itself after some time:

new jBox('Notice', {
 content: 'Hurray! A notice!'
});

Images

To create image windows you only need following few lines:

new jBox('Image');
<a href="/image-large.jpg" data-jbox-image="gallery1" title="My image">
  <img src="/image.jpg" alt="">
</a>

Learn more

These few examples are very basic. The jBox library is quite powerful and offers a vast variety of options to customize appearance and behavior. Learn more in the documentation: https://stephanwagner.me/jBox/documentation

jbox's People

Contributors

astegmaier avatar dependabot[bot] avatar gfyoung avatar ghaecker avatar mikk3lro avatar stephanwagner avatar timgates42 avatar vancromp 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.