Giter Site home page Giter Site logo

atalrefai / unimodal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rainjeck/unimodal

0.0 1.0 0.0 4.77 MB

Simple Vanilla Javascript Modal

Home Page: https://rainjeck.github.io/unimodal/

CSS 4.28% JavaScript 24.79% HTML 68.05% Stylus 2.88%

unimodal's Introduction

Unimodal

Simple Vanilla Javascript Modal

  • Universal
  • Simple
  • Style what you want
  • Hash support

Demo & Documentation


Get Started

Include css

This is basic styles. You can change what you want and need.

<link rel='stylesheet' href='unimodal.css'>

Include JS

<script src='unimodal.min.js'>

Use

HTML:

<!--
Important attributes:
  - [data-unimodal] - modal element
  - [data-unimodal-body] - modal body element
  - [data-unimodal-close] - modal close button
-->

<!--- Open Modal Button -->
<a href='#!' data-unimodal-open='simple-modal'>Open Modal</a>

<!--- Modal Markup -->
<div class='unimodal' id='simple-modal' data-unimodal></div>
  <div class='unimodal-body' data-unimodal-body>
    <button type='button' data-unimodal-close>Close</button>
    <!--- Your Content Here -->
  </div>
</div>

JavaScript:

const modal = new Unimodal({
  scrollWindow: false, /* enable or disable window scroll */
  hash: false, /* hash support */
  onOpen: ( modal, button ) => {
    /* ... do your staff here ... */
  }
  onClose: ( modal ) => {
    /* ... do your staff here ... */
  }
});

Public Methods:

/* Open Modal */
Unimodal.open('your-modal-id', () => {
  /* ... your callback here ... */
});

/* Close Modal */
Unimodal.close('your-modal-id', () => {
  /* ... your callback here ... */
});

/* OR */
modal.open('your-modal-id');
modal.close('your-modal-id');

unimodal's People

Contributors

rainjeck avatar

Watchers

 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.