Introducing: Launchy!
Do you ever need to add a modal window to your app or website? No time to code it up yourself and are unsure of which third-party script to add? What’s that? You also want to make sure it’s fully accessible via keyboard and screen reader friendly?
Look no further, friend! Launchy! is a fully accessible, super easy to implement and use, modal window script. It’s free and open source, well tested, and just works!
How do I get Launchy?
There are a couple ways to get your hands on a copy of Launchy!:
Raw file include
-
Copy and paste the source of
launchy.js
into a new JavaScript file in your project. -
Include the script in your template:
<script src="js/launchy.js"></script>
Via NPM
Probably the better approach would be to use npm
to install the script. This way you get the latest version automatically when it becomes available!
-
Run the command:
npm i launchy-modal-window
This will install the script into your
node_modules
directory. -
Include the script in your template:
<script src="node_modules/launchy-modal-window/launchy.js"></script>
Now that I have it, how do I use it?
Using Launchy! is super easy!
-
Add your HTML content to your page or template that you’d like to appear in the modal window, or find some existing content.
Example:
<h2>Top 5 Most "Popular" Websites</h2> <ul> <li>Google.com</li> <li>Youtube.com</li> <li>Facebook.com</li> <li>Baidu.com</li> <li>Wikipedia.org</li> </ul>
-
Now, simply wrap your content with an HTML container with a
data-launchy
attribute. You also need adata-launchy-text
attribute which translates into the launcher control text:<div data-launchy data-launchy-text="Popular websites!"> <h2>Top 5 Most "Popular" Websites</h2> <ul> <li>Google.com</li> <li>Youtube.com</li> <li>Facebook.com</li> <li>Baidu.com</li> <li>Wikipedia.org</li> </ul> </div>
That’s it! Launchy! will detect this div
with the data-launchy-*
attributes and generate everything required to build the modal window for you!
A note on styling
Launchy! does not come with any styles by default, but does feature lots of CSS classes you can hook into!
Check out the demo styles.scss
file for an example on how to use the available classes. Alternatively, try out some custom styling over on the CodePen demo!
- Check out the source code over on GitHub!
- You can try this example HTML out over on the CodePen demo!
Let me know what you think and if you try this out, how it went! Find a bug or have an idea? Feel free to open a new issue!
Happy hacking! 💻😄💖