Hey guys and gals,
I am working on a lightbox effect for this page that has multiple modals, that is currently not working. I am still new to jQuery, so bear with me. I think the code is almost there, but I'm still not getting the syntax correct. Here is a link to the page:
Also, the code is minified, so here is the original .js file:
- $(function() {
- /* Initiate lightbox for single modal---------
- $('.triggle').on('click', function(e) {
- e.preventDefault();
- $('div.modal').fadeIn(400);
- $('.overlay').fadeIn(400);
- }); */
-
- // Open modal triggered by specific anchor
- $('div.triggle').on('click', function(e) {
- e.preventDefault();
- var id = $(this).data('id');
- $('div.modal').data('id' === $(id)).fadeIn(400);
- $('div.overlay').fadeIn(400);
- });
- // Close Modal Window
- $('a.close').on('click', function(e) {
- e.preventDefault();
- $('.modal').fadeOut(800);
- $('.overlay').fadeOut(800);
- });
- });
So, my goal is to match the modal (using the data attar) with whatever anchor is selected. Any help is welcome.
Thanks so much!
Casey Baggz