Skip to content

Instantly share code, notes, and snippets.

@auxiliary
Last active August 29, 2015 14:22
Show Gist options
  • Save auxiliary/6464ad5f71be70655fae to your computer and use it in GitHub Desktop.
Save auxiliary/6464ad5f71be70655fae to your computer and use it in GitHub Desktop.
A data-attribute add-on for custombox
function open_custombox()
{
var modal_settings = $(this).data("modal");
if (typeof(modal_settings) === 'string')
{
Custombox.open({
target: modal_settings
});
}
else if(typeof(modal_settings) === 'object')
{
Custombox.open(modal_settings);
}
}
var selection = document.querySelectorAll("[data-trigger='modal']");
for (var i = 0; i < selection.length; i++)
{
selection[i].addEventListener("click", open_custombox);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment