Simple Modal Plugin Written In Pure JavaScript | tingle.js

Tingle is a simple modal plugin written in pure JavaScript that creates a full-screen modal popup and rich content with CSS3 transitions for open/closed animations.

  • No dependencies required
  • Fully customizable via CSS
  • CSS transitions
  • Simple API
  • No extra files to download
  • Created with UX in mind

Easy to Use Modal/Alert/Dialog/Popup with Vanilla JS | EinsModal

How to make use of it:

1. Load the tingle.css style sheet into the header of your document.

<link href="dist/tingle.css" rel="stylesheet">

2. Load the basic JavaScript file tingle.js into the document as needed.

<script src="dist/tingle.js"></script>

3. Wrap the conditional content in a DIV container.

<div class="tingle-demo">
  Modal Content
</div>

4. Create a button to toggle the modal.

<button class="trigger-button">Lanuch the modal</button>

5. Modal formatting.

tingle.modal.init();

6. Enable the trigger button to trigger the corresponding model.

var btn = document.querySelector('.trigger-button');
btn.addEventListener('click', function(){
  tingle.modal.setContent(document.querySelector('.tingle-demo').innerHTML);
  tingle.modal.open();
});

7. More API methods.

// close the modal
tingle.modal.close();
// remove the modal from DOM
tingle.modal.destroy();
// set modal content
tingle.modal.setContent('');

Options

NameTypeDescription
footerbooleanDisplay a footer or not
stickyFooterbooleanSet to true for a footer always visible on screen
closeMethodsarrayAvailable close methods (overlay, button, escape)
onOpenfunctionCallback to execute when tingle is open (after transition end)
onClosefunctionCallback to execute when tingle is closed
beforeOpenfunctionCallback to execute before opening the modal
beforeClosefunctionCallback to execute before closing the modal (must return true to close the modal)
cssClassarrayCustom CSS classes that will be added to tingle container
closeLabelstringLabel which appears on the close button (mobile version)

API

NameDescription
open()Open modal (tingle-enabled class is added on body)
close()Close modal and execute callback if exist
setContent(content)Set modal content
getContent()Get modal content
setFooterContent(content)Set footer content
getFooterContent(content)Get footer content
addFooterBtn(label, cssClass, callback)Add buttons to the footer (use cssClass for style and positioning)
checkOverflow()Allow repositioning the modal (useful with asynchronous content)
isOverflow()Return true if modal height is bigger than viewport height
destroy()Destroy modal (remove from dom and unbind events)
resize() deprecatedDeprecated since v0.8 and will be removed in v1.0

javascript modal popup with css3, tingle.js Plugin/Github


See Demo And Download

Official Website(robinparisi): Click Here

This superior jQuery/javascript plugin is developed by robinparisi. For extra advanced usage, please go to the official website.

Related Posts

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Sidebar-Menu-Responsive-Template

Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Leave a Reply

Your email address will not be published. Required fields are marked *