Giter VIP home page Giter VIP logo

modaal's Introduction


  • Version 0.4.4
  • Requires jQuery 1.11.2 or higher (v2 not tested, v3 works but not extensively stress tested).
  • Built by Humaan

Modaal

Modaal is a WCAG 2.0 Level AA accessible modal window plugin.

Demos

View Modaal Demos

Another modal plugin? why?

It's hard to find a plugin with the right mix of quality, flexibility and accessibility. We thought it would be interesting to develop something that would work in a variety of projects, furthering the cause for an accessible web.


1. Getting Setup

1.1. Installation

  • Download ZIP
  • First, copy and paste js/modaal.min.js in your project, and link to it before the closing </body> element.
  • Next, you'll need to copy and paste the plugin's css into your project. We include both a SASS file and CSS file for flexibility.
  • Lastly, link to your new modaal.css file before the closing </head> element.

Note: This plugin requires your website or application already runs a copy of jQuery, version 1.11.2 or higher. Currently version 2 has not been tested. Version 3 works but has not been stress tested for bugs/issues.

1.2. Installation with Package Managers

Modaal is now setup and ready to be used with Bower and NPM and can be installed using the following commands.

bower install  modaal

npm install  modaal

1.3 Installation with CDN

Modaal is now setup and ready to be used with CDN JSDelivr jsDelivr Hits

1.4. The Basics

Out of the box Modaal is setup to work using inline content using as little customisation as possible. The first thing you'll require is a link to trigger the modal window. It's recommended that your href attribute targets a unique ID for a hidden element on the page containing your modal content. Like so:

<a href="#inline" class="inline">Show</a>
<div id="inline" style="display:none;">
	<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</div>
$('.inline').modaal();

If you would prefer your trigger element is not an <a href="#">, you can define a content_source value like so:

<button class="inline">Show</button>
<div id="inline" style="display:none;">
	<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
</div>
$('.inline').modaal({
	content_source: '#inline'
});

2. Configuration

2.1. Practical Example

$('.my-link').modaal({
	type: 'ajax',
	loading_content: 'Loading content, please wait.'
});

2.2. Configuration Options

key type default values notes
type string inline ajax
inline
image
iframe
confirm
video
instagram
content_source string null Accepts a string value for your target element, such as '#my-content'. This allows for when trigger element is an <a href="#"> link. Not to be confused with the already existing source event.
animation string fade fade, none
animation_speed integer 300 Animation speed is the duration it takes to reveal the Modaal window once triggered. It's important to note, that if you change this, you must also change the after_callback_delay below so that callback events sync up. This will be overwritten and set to 0 if type is none.
after_callback_delay integer 350 Specify a delay value for the after open callbacks. This is necessary because with the bundled animations have a set duration in the bundled CSS. Specify a delay of the same amount as the animation duration in so more accurately fire the after open/close callbacks. Defaults 350, does not apply if animation is 'none', after open callbacks are dispatched immediately
is_locked boolean false true
false
Set this to true to disable closing the modal via keypress or by clicking the close or background. Beware that if type is confirm there will be no interface to dismiss the modal. If is_locked is true, you'd have to programmatically arrange to dismiss the modal. Confirm modals are always locked regardless of this option.
hide_close boolean false true
false
Set this to true to hide the close modal button. Key press and overlay click will still close the modal. This method is best used when you want to put a custom close button inside the modal container space.
background string #000 Sets the background overlay color
overlay_opacity float 0.8 Sets the background overlay transparency
overlay_close boolean true true
false
Controls whether the overlay background can be clicked to close.
accessible_title string Dialog Window Set the aria-label attribute value used for Accessibility purposes.
start_open boolean false true
false
Set this to true if you want the Modaal window to launch immediately on load.
fullscreen boolean false true
false
Set this to true to make the Modaal fill the entire screen, false will default to own width/height attributes.
custom_class string '' Fill in this string with a custom class that will be applied to the outer most modal wrapper.
background_scroll boolean false true
false
Set this to true to enable the page to scroll behind the open modal
should_open boolean
function
true Set to false or make the closure return false to prevent the modal from opening
close_text string Close String for close button text. Available for localisation and alternative languages to be used.
close_aria_label string Close (Press escape to close) String for close button aria-label attribute (value that screen readers will read out). Available for localisation and alternative languages to be used.
width integer null Set the desired width of the modal.
height integer null Set the desired height of the modal.
gallery_active_class string gallery_active_item Active class applied to the currently active image or image slide in a gallery
outer_controls boolean false true
false
Set to true to put the next/prev controls outside the Modaal wrapper, at the edges of the browser window.
confirm_button_text string Confirm Text on the confirm button.
confirm_cancel_button_text string Cancel Text on the confirm modal cancel button.
confirm_title string Confirm Title Title for confirm modal. Default
confirm_content string <p>This is the default confirm dialog content. Replace me through the options</p> HTML content for confirm message
loading_content string Loading &hellip; HTML content for loading message.
loading_class string is_loading Class name to be applied while content is loaded via AJAX.
ajax_error_class string modaal-error Class name to be applied when content has failed to load. Default is ''
instagram_id string null Unique photo ID for an Instagram photo.

2.3. Inline Attribute Configuration

Modaal has been developed to support common jQuery configuration options, but in an effort to extend functionality and widen its usage we've developed support for inline data-option-name attribute support.

To enable this, the Modaal trigger link must have a class of modaal, then you can add attributes to the link as needed like so:

<a href="#inline" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">Show</a>

Or for non <a href="#"> elements:

<button data-modaal-content-source="#inline" data-modaal-type="inline" data-modaal-animation="fade" class="modaal">Show</button>

It's important to note, that configuration options that contain an underscore (_) in them need to be replaced with a hyphen (-) in it's respective html attribute. For example, overlay_opacity configuration would read data-overlay-opacity="0.8".

2.4. Configuration Events

event params notes
before_open event Executed before the modaal has revealed
after_open modal_wrapper Executed once the duration for Option after_callback_delay has expired after the open method is called.
before_close modal_wrapper Executed once the Modaal has been instructed to close.
after_close Executed once the the duration for after_callback_delay has expired after the close method is called.
before_image_change current_item
incoming_item
Executed before the image changes in a gallery Modaal.
after_image_change current_item Executed after the image has changed in a gallery Modaal.
confirm_callback lastFocus Executed when the confirm button is pressed as opposed to cancel.
confirm_cancel_callback lastFocus Executed when the cancel button is pressed as opposed to confirm.
source Callback function executed on the default source, it is intended to transform the source (href in an AJAX modal or iframe). The function passes in the triggering element as well as the default source depending of the modal type. The default output of the function is an untransformed default source.
ajax_success target Callback for when AJAX content is loaded in
2.4.1 Working With Events

There are two approaches to using events. The first is to call the entire function() { } in where the event configuration is set as seen below in before_open, and the second is to reference only the JS function name where the rest of the action occurs, as seen below in after_open.

$('.my-link').modaal({
	before_open: function() {
		alert('Before open');
	},
	after_open: myFunction
});

function myFunction() {
	alert('After open');
}

3. Methods

3.1. Programatically Creating Modaals

To initialise a programatically created Modaal, but not open, it can been called like any other doc ready instance, with

$('.my-link').modaal();

Or with any options as available:

$('.my-link').modaal({
	type: 'ajax',
	loading_content: 'Loading content, please wait.'
});

3.2. Programatically Open a Modaal

For any modaal instance that has already been initialised, it can be triggered to open with

$('.my-link').modaal('open');

If the modaal has been programatically created and needs to open straight away, the following approach can be used to initialise and open immediately:

$('.my-link').modaal({ start_open: true });

This approach allows you to define other options that may be required as well as open immediately once it's ready.

3.3. Programatically Close a Modaal

Currently Modaal only supports a close method which can be called like so.

$('.my-link').modaal('close');

Based on this example, we know we've already established (and opened) the modal associated to the .my-link class, so to close we use the same selector with a string of close instead of options;

4. Tips & Tricks

4.1. Avoiding Conflicts

Through development, we've worked hard to ensure no conflicts will occur with any existing code, however it's important to note some of the classes currently in use and best to avoid in your own stylesheet. These include:

modaal-inline, modaal-ajax, modaal-image, modaal-confirm, modaal-iframe, modaal-video, modaal-wrapper, modaal-outer-wrapper, modaal-inner-wrapper, modaal-container, modaal-close, modaal-content

4.2. Customising the CSS

We wanted to provide users the chance to really extend on Modaal's base through customising the modal styles to meet their own project. We understand working with various projects and differing styles how important it is to tailor the aesthetics right down to even the most minute detail.

Provided in the distribution files are both un-minified css and SASS files to best integrate with your workflow. Within the SASS file you'll find a number of variables located at the top of the document for which you can tweak as desired.

It's our recommendation, should you wish to change any styling, that you minify your final output so as to save on overall page weight. The primary recommendation would be to run the gulp dist task which will minify the CSS (and JS if changes have been made), with another alternative to be found at cssminifier.com.

4.3. Video file URLs

The Modaal video type has been tested thoroughly using both Vimeo and Youtube. For best outcome, please ensure the url format looks like the one of the following below. We transplant this URL into an iframe which then each service provider controls all the necessary play back from there.

4.3.1. Youtube

https://www.youtube.com/embed/cBJyo0tgLnw where the ID at the end is your unique video id. This can be found by selecting 'Share' on a youtube video, then clicking on 'Embed'. You'll find this URL within the content presented.

4.3.1. Vimeo

https://player.vimeo.com/video/109626219 where the ID at the end is your unique video id. This can be found by selecting 'Share' on a vimeo video (commonly seen on the right hand side), and by selecting the content within 'Embed'. You'll find the URL necessary towards the very beginning of that embed code inside src="".

5. Reporting issues and contributing code

5.1. Reporting an issue

  1. Please ensure the issue you're reporting is reproducible in a standalone environment, and not a result of something in your own build.
  2. Use jsFiddle or jsBin to provide a test page showing issue.
  3. In your issue, please indicate which browser, operating system and os version you're using.
  4. Please also indicate plugin version.
  5. If you have made any alterations to the plugin files (JS or CSS), please also list and include code samples.

The more information you can provide regarding an issue, the better.

5.2. Contributing to the plugin

Thanks for your contribution! Please refer to the guidelines below.

  1. Please ensure the issue you're reporting is reproducible in a standalone environment, and not a result of something in your own build.
  2. Please ensure your pull request has a base branch of develop selected. pull request's with base master will not be accepted.
  3. Please ensure the problem you're resolving has an open issue ticket.
  4. Adhere to the current style and formatting of the plugin files, including CSS, SASS and JS.
  5. Please ensure any changes are tested thoroughly in multiple browsers. We will do this, but if we locate bugs in the new code, the pull request will not be accepted.
  6. Outline all changes in your commit message and also reference the issue ticket. For example "Contribution: Fix for issue #17 - Update to XYZ file to do make it do ABC"

5.3. Development Setup

  1. Ensure you're running NodeJS
  2. Install Gulp by running npm install --global gulp. More details are available through the Gulp documentation.
  3. Install the NPM dependencies by running npm install. (if this throws an error, try sudo the command).
  4. The build can now be called by running gulp watch to watch for SASS updates.
  5. When you're happy with the final output, please also run gulp dist to minify and compress changes.

License

Copyright © Humaan Licensed under the MIT license.

modaal's People

Contributors

abishekrsrikaanth avatar cbotman avatar danb-humaan avatar danhumaan avatar dlawidjaja avatar lee-karolczak avatar lukasdrgon avatar marcobiedermann avatar marcofugaro avatar nil1511 avatar pzi avatar radarhere avatar synthels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modaal's Issues

Holding down tab causes the tab scope to break from the modal content

Tabbing through slowly seems to maintain the tab scope to within the modal content and address bar but when I held down tab, it breaks out of the modal content and I can start tabbing through the main web content that should not be in focus.

Browser: Google Chrome 50.0.2661.75 m

Compatibility

Hi,

First of all thank you for this awesome plugin.
I would like to know if you have information about IE Compatibility and compatibility for other browsers.
Thank you

Page shift on modal open, two scrollbars on modal close

Hello.
Thanks for plugin.

When I open modal window, my page jump in right direction for a half scrollbar width.
It happens because you block page by overflow: hidden; and original scrollbar disappear.
I think here is no choice but to remember scrollbar width and set suitable padding-right.
(check bootstrap modal for example)

When I close the window I see two of scrollbars: http://prntscr.com/b67niq
I think you should release page back to normal only after fade out animation is finished.
(check magnific popup for example)

If you guys work on MAC you probably see no scrollbars at all. There is an option in system settings to turn on scrollbars: http://prntscr.com/b67pgu

Add event/method to determine whether to open or not

I propose adding an event during the open call that can be used to determine whether the modal should open. As the logic behind the event would be performed in the event itself, rather than in Modaal, so this would increase the filesize by only a fraction.

Ideally it should take either a boolean value, or a closure to be called.

I can tackle this later during the week, pending @danhumaan's thoughts.

Please dont touch body

Add ''overflow: hidden'' for body, in time open modal is bad, becouse its side effect for you independent module and you can break someone else's layout.

Remove jQuery dependency

Why this needs jQuery? Why do I need to load full jQuery lib just be able to use it? It doesn't seem justifiable in 2016

Register the modal without link

I didn't find in the documentation to register the modal without a link. Is this possible? e.g: I want to trigger the modal when a div is clicked. I can't just use a tag, because the div contain some a tags.

Messages translatability

Hello,
First of all, thanks for your work. Nice to have a solution where accessibility is a key parameter.
I've started implementing Modaal on my website where the main language is Russian. And I found that the system messages like "Close" on the Close button seem not to be translatable. Ideally, this should be localizable at least in the configuration.
Any help would be highly appreciated. I could accomplish most of the work myself and send you a pull request, but first of all I would like to know how you want to proceed with it.
Thanks!

Unable set Modaal width or height

I am not able to set width or height of the modal by both default as well as inline attribute method. I tried this:
<script type="text/javascript"> $('.modaal-inline').modaal({ type: 'inline', accessible_title: 'Modal title', width: '400', height: '200' }); </script>
and also this
<a href="#inline-content" data-modaal-type="inline" data-modaal-width="200px" data-modaal-accessible-title="Inline Dialog Window" data-modaal-overlay-opacity="0.4" class="modaal">Show Modaal</a>

Am I doing it wrong?

Having trouble with "is-locked"

I cannot seem to get the is-locked option to work for me using the inline data-option-name method. Calling it through a jQuery call does work for me:

<script>
    jQuery( document ).ready(function() {
        jQuery('.modaal').modaal({
            is_locked: 'true'
        });
    });
</script>

Here is a jsfiddle where I am trying to get it working inline.

https://jsfiddle.net/bmcwebdev/mouvcbgq/

Thanks gang!

Problem with jQuery-File-Upload plugin in modal

I am trying the initialize the fileupload like

$('.modal_selector').modaal({
        after_open: function () {
            $('.image_selector').fileupload();
        }
    });

but is not working and throwing
cannot call methods on fileupload prior to initialization; attempted to call method 'option' error in console.

.bind() vs. .on()

I notice you use .bind() for the keyboard events, but use .on() for the click events. Just wondering if there is something you've noticed about how the methods perform that made you decide to use the different methods?

Option to display .modaal-close button text

I think it would be nice to be able to opt to display the clipped 'close' text on the close button.
Doing so may require that the before and after be positioned right rather than left.

Scrollbars disappearing

Issue with scrollsbars

Where scrollbars are visible, like the demo page, the modal will make them disappear. This causes a jump on the content.

Tested on Chrome 50, Windows 10.

To reproduce:

  1. Go to the demo site
  2. Click 'View Example'
  3. Behold, the scrollbar disappears!

Mobile close compatability

A few things that could be improved on for mobile compatibility:

  1. White close button is hidden when you scroll the modal on a small screen.
  2. Back button on Android could/should close modal.

The first could be solved with mediaquery style change.

The second would require some form of location.hash change when the modal is open. That way the back button would remove it, and you could catch that change and close the modal.

Model content should include top-level text nodes

The Inline Content example (and others) are actually wrong at the moment. E.g.

<a href="#inline" class="inline">Show</a>
<div id="inline">
        Inline content goes here...
</div>
JS$(".inline").modaal();

This is because this line in create_basic:
content = target.children().clone(true,true);

Should be:
content = target.contents().clone(true,true);

Otherwise we're not grabbing top-level text nodes. Need to review the other modal creation methods for the same issue too.

Until this is fixed, an example like the above will show an empty modal. You can get around that by wrapping "Inline content goes here..." with an element. E.g. div, span, p

Large images overflow viewport when height > 1024px

Large images overflow the viewport when the viewport height is greater than 1024px. At smaller sizes the image more appropriately is maxed at a height of 85vh.

I see no reason why the img element shouldn't have a max-height (and max-width for that matter) of 85vh/vw at all viewport sizes.

Image and video gallery

Right now there I see only an option for rel="gallery" in one type: image or video. If I add a video to an image gallery, there is in tag on the video link, and no iframe. Is there a way to for inner navigation to image and video gallery combined? Thank you!

Npm or Bower installation

I think it would be nice to have possibility to install plugin via Bower and Npm package managers.

Request: AJAX- specify content to use in Modaal

When calling content to the Modaal via AJAX, it would be really beneficial to specify a content area to use, rather than using the whole page and having to manually remove unnecessary markup.

jQuery supports this kind of function through it's .load function (a shorthand of .ajax)

$( "#result" ).load( "ajax/test.html #container" );

This allows the targeted page to be a 'complete' page, so if javascript fails or is disabled, or even if you wanted to disable the functionality of mobile for example, the user could still go to a legit page with regular markup (headers and footers etc...).

Love the Modaal by the way.

Video auto play

Firstly, thanks for a great plugin. The simplicity is certainly welcomed and refreshing.

On to my question... is there a way to auto play videos on open of Modaal? Specifically looking for Vimeo but I guess both YouTube and Vimeo would be helpful.

Issue on iPhone with background_scroll

I'm not sure how widespread this issue is on mobiles but I've noticed a couple of related issues:

  • On iPhone 6, the background_scroll property is not having any affect. I.e. the background is scrollable even when set to false.
  • Related to that, it's possible to push the overlay out of the way, like in the screenshot (thanks @lee-karolczak).

img_0378

Experimenting with ideas here (http://stackoverflow.com/questions/9280258/prevent-body-scrolling-but-allow-overlay-scrolling) I was able to prevent the second issue (pushing the overlay), but the background was still scrolling.

I think fixing this might be a prerequisite to fixing #22 (scroll momentum on mobile).

Send focus to more semantic element on open

The modal has focus management but when it opens, nothing is announced in Voiceover. If you send focus instead to the element with role="dialog" and an aria-label, those will be announced when the dialog opens. Or you could send focus to the close button–I've heard of people doing it either way.

Here is a screenshot showing the wrapping dialog and DIV inside with tabindex="0":
Dialog with browser dev tools open onto DOM

You could move tabindex to the dialog element and change its value to -1, that way it won't be in the explicit tab order.

Using the <dialog> tag

You could look at the HTML5 dialog tag, as it will give much better symantics for assistive devices (or simply the browser) to use.

For example, when the dialog is "open" and "modal", supporting browsers will limit the focusable controls to those elements within the dialog (e.g. tabbing between elements won't focus anything else on the page, so you don't need to do anything in JS to fix that).

https://github.com/GoogleChrome/dialog-polyfill

https://developer.mozilla.org/en/docs/Web/HTML/Element/dialog

Focus styles for demo buttons

A minor thing code-wise but an immediate blocker for some keyboard users:
The demo page (http://www.humaan.com/modaal/) doesn't have any keyboard-focus styles.
The dialogues themselves do (which is great) but it is hard to tell which one you are opening on the demo page.

I think it would be a matter of adding :focus to the :hover styles (e.g. demo.scss line 133), so the visual effect is there for keyboard users as well.

There might be other places where it needs adding, but a search of 'hover' would probably find them.

Sorry, I'd fork it, change it, test it, and do a pull request, but by the time I've done that would be about 3 months from now!

Open modal on page ready

Is there an option already built in to open the modal on page ready? I notice in the js file you have a section to look if there is only one modal on the page (on page load check if single '.modaal' exists) wondering if this is related. Thank you for the well done work.

Use flexbox instead of table layout for greater flexibility

Using table layout comes with certain limitations, especially at extreme edge cases of viewport sizes/aspect ratios; e.g., the caption box is currently hidden if the viewport is too short vertically.

Using flexbox will make it easier to adapt to a wider range of viewport sizes/aspect ratios moving forward.

Another way for focus to escape modal (shift+tab as first action)

When a modal opens, if the first action you perform is to press shift+tab (i.e. previous link), it escapes the modal and focuses the first background link.

If your first action is to press tab, then you hit shift+tab twice, it doesn't then escape modal, so my guess is we're doing something when tab is pressed to restrict the focus, but we're not doing the same action on shift+tab.

Automatically close Modaal when video stops playing

Hey, first off - thanks for a superb solution for modals.

I have a modaal that has a Vimeo (YouTube is also useful) video that autoplays when you open it. Though once it's stopped playing you have to manually close the modaal.

Is it possible to make it so the modaal closes automatically once the video ends? It would be a very useful feature if not! I appreciate any help.

Thanks in advance.

Review/revise Modaal load process

See ticket #33 for some background. In short, this JS Fiddle example (https://jsfiddle.net/mouvcbgq/) fails in part because Modaal is being loaded in a body onload event, and internally Modaal calls $.fn.modaal in its onload event before $.fn.modaal is declared (due to the order in the source code).

As such, it'd be good to review/revise any onload related events in Modaal so that the library can be included at any stage after jQuery is loaded, and it'll just work. For one thing, this will make JSFiddle examples easier as most people won't know to change the JavaScript On Load setting in JSFiddle (and shouldn't be expected to).

Inline method hides content after close

Not sure if this is a bug, but when you use the inline method -- which works awesome -- and then close the modal window, that element you launched is removed or hidden from the DOM.

Is there a way to avoid that?

I tried doing a callback function to set the CSS on the element to 'block', but that didn't work.

Open method

"Currently Modaal only supports a close method which can be called like so."
Why does it only support close instead of supporting open & close ? open method is useful when we want to trigger the modaal's open programatically

Duplicate iFrame markup and iFrame width/height

There's two minor markup changes that I've discovered need resolving:

  1. There is duplicate iframe markup for .modaal-content which needs to be resolved.
  2. With the new width and height updates in #27 being applied to the outer .modaal-container, we should simplify the JS and set the iframe elements width/height to 100% to fill it's parent element. This will also allow it to become responsive by using max-width instead of width on the iframe element itself.

Remove JQuery dependency.

Looking at your code, I don't really see why you're using JQuery. You could easily remove this dependency by replacing it with native JavaScript calls.

e.g.
var dom = document.body;
var element = document.querySelector('.class-name');
if(element.classList.contains('class-name') {};
element.addEventListener('click|keydown', function);
etc.

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.