![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Modals built out of pure CSS
Please visit the website to read more about this project and refer to the FAQ in case of a question.
(aka. Gittip) if you enjoy this plugin.
Built with pure CSS: CSS Modal is built out of pure CSS. JavaScript is only for sugar. This makes them perfectly accessible.
Optimized for mobile: The modals are designed using responsive web design methods. They work on all screen sizes from a small mobile phone up to high resolution screens.
Use as Sass plugin: You can use CSS Modal as Sass plugin and apply it to your custom classes. No need to understand all the code.
A few other advantages: Accessible, cross-browser, media-adaptive, small and fast!
Please be aware that modals get stacked above each other if you open one modal
from within another. You can add a data-attribute data-stackable="false"
to
the modal in order to make it non-stackable.
You need to include the markup and content for modals in your website. This has a positive effect on SEO. The example code:
<section class="modal--show" id="modal-text" tabindex="-1"
role="dialog" aria-labelledby="modal-label" aria-hidden="true">
<div class="modal-inner">
<header id="modal-label"><!-- Header --></header>
<div class="modal-content"><!-- The modals content --></div>
<footer><!-- Footer --></footer>
</div>
<a href="#!" class="modal-close" title="Close this modal" data-close="Close"
data-dismiss="modal">?</a>
</section>
The id
attribute is the one which identifies the modal. You can link to this
ID from everywhere.
Please note that the ID cannot include the
/
character since this one is needed for identifying stacked modals.
Using header and footer is optional. Just remove the tags if you don't want them in a modal.
You should leave the link's href attribute that way to close the modal in order to prevent the page from scrolling to top when clicking on it.
Please remember to set a unique ID for the header and change the
aria-labelledby
attribute to the same value.
You link to a modal by simply setting the ID to a link element's href
like this:
<a href="#modal">Modal</a>
If you want to decouple the modal call from the location's hash you need to add
data-cssmodal-nohash
to the link.
If you use Sass you can use the file modal.scss and include it into your project. Here is an example:
@import "modules/modal";
CSS Modals uses Sass's placeholders. You can use them by calling them via @extend in your modal's class name. The snippet looks something like that:
.my-awesome-class-name {
@extend %modal;
}
As stated above you don't need JavaScript to get a good experience out of CSS Modals. But there are some issues where JavaScript helps:
cssmodal:show
. When the modal is hidden, an event called cssmodal:hide
is
triggered.<script src="js/modal.js"></script>
This modal is designed to work on all modern browsers. Unfortunately this does not include Internet Explorer 7 or lower. But we deal with IE 8 – well,… at least it works.
On mobile Safari for iOS and Android 4+ it is tested pretty well, while Android 2.3 has some problems (biggest issue is scrolling). It's also working on Windows Phone 8.
In numbers:
Please be aware that you need to stop playing videos or audio manually after hiding the modal. We have a plugin for this though.
There is an event cssmodal:show
fired on the modal itself after the modal is
shown. Another event cssmodal:hide
is fired after the modal is hidden.
You can use the events by subscribing to them as if they were click events or something. Here is an example using jQuery:
$(document).on('cssmodal:show', function (event) {
console.log(event);
});
There events are not fired in IE8. Please be aware of that and use jQuery or something else to create custom events.
We have a couple for the modal to enhance it:
If you got something that's worth including into the project please open an issue for further discussion.
Please see the section on contributing on the website.
This is a project by Hans Christian Reinl. Thanks goes out to all other contributors.
1.5.0 - 12.05.2016
FAQs
Modals, built with pure CSS
The npm package css-modal receives a total of 35 weekly downloads. As such, css-modal popularity was classified as not popular.
We found that css-modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.