Last active
August 29, 2015 14:22
-
-
Save auxiliary/6464ad5f71be70655fae to your computer and use it in GitHub Desktop.
A data-attribute add-on for custombox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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