Giter Club home page Giter Club logo

jquery-accessible-modal-window-aria's Introduction

jQuery Simple and Accessible Modal Window

This jQuery plugin provides you a shiny and accessible modal window, using ARIA.

A presentation page and demo is here: http://a11y.nicolas-hoffmann.net/modal/ (with styles, etc.)

How it works

Basically, it wraps all the page into a div id="js-modal-page", and when you activate one modal, the scripts inserts a dialog element at the end of your page, adds the noscroll class on the body element (to remove scroll with CSS if needed), puts the focus into it and traps focus in the modal window. When you exit it, the focus is given back to the element that opened it.

For mouse users, they can click outside the modal window to close it. For keyboard users, you can strike Esc to close it.

If you never activate a modal window, it won’t be anywhere in the code.

Options and attributes

Simply put class="js-modal" on a button or a link to activate the script.

  • Attribute data-modal-text: the text of your modal window (will be put into a p tag).
  • Attribute data-modal-content-id: the id of (hidden) content in your page that will be put into your modal window.
  • Attribute data-modal-title: the main title of the modal window.
  • Attribute data-modal-close-text: the text of the close button in your modal window.
  • Attribute data-modal-close-title: the title attribute of the close button in your modal window.
  • Attribute data-modal-background-click="disabled": disable the possibility to click outside the modal window to close it.

Enjoy.

Chuck Norris approved this

P.S: this plugin is in MIT license. It couldn't be done without the precious help of @ScreenFeedFr, @sophieschuermans, @johan_ramon, @goetsu and @romaingervois.

jquery-accessible-modal-window-aria's People

Contributors

nico3333fr avatar sandra-arato avatar

Stargazers

 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.