Using micro-modal

In the course of working on a freelance project, I took the time to build this as an example for how I was going to add modal functionality to the client's site.

Adding a Modal-activator

It only takes a small amount of code to activate a modal

<a class="btn" href="#modal-window">Activate Modal Window</a>
<script>
	$(function(){ $('.btn[href=#modal-window]').modalPanel(); })
</script>

This is the modal heading

This is the text of the modal

Activate Modal Window

Adding a close butting

Again very little code is required:

$(selector).on('click',function(){ 
	$(this).parents('#modal-window, .modal-window').trigger('do-close'); 
});

This is the modal heading

This is the text of the modal

×
Activate Modal Window