Another method that might work which I just thought of would be to add 2 classes to the link for each modal.
1. General class – eModal
2. Modal specific – eModal-1 etc
When a user clicks on object with class 1 jQuery detects class 2.
I know I can then pass class 2 to my Ajax query but I’m at a loss to figure out how to pass other java specific settings like overlay colors. Callbacks etc back to the script after detection.
I’m leaning towards using php to dynamically create the scripts for all the modals detected but I can already see flaws with this method that I would need to address.
1. If user created 100 modals then the script could get potentially large.
2. Cacheing issues with a dynamic scripts.
Ok so after looking around the net for a few I’m wondering if this might work.
On page load detect all modals and build a list.
Call jQuery $.getScript to load the dynamic script with settings for the list of detected modals.
Another option would be to create a single jQuery function with all option routes built in.
Problem I’m trying to figure out there is how to get and pass the options to the function as each modal link will need to activate different options based on it’s second eModal class
Maybe filter wp content and find all modal classes. Use this list to get each set of options and pass them via wp enqueue localized options?