I am new to JS and would like to know how to rewrite the code below to allow for more than one link.This uses the JQuery Reveal by Zurb and works great for one link to pop a modal window containing a video.
I don’t know how to write or reference a JS variable. I know that this can be passed from the link into the function to then target different “modal” divs but don’t understand how to read that value (video1 opens modal1, video2 opens modal2, etc).
I’d like to understand this basic concept so I can apply it to other JavaScript.
Thanks!
It has a text link: <a href=”#” id=”video1″>my link</a>
a hidden div: <div id=”modal”> . . . containing a video
and this JS:
[code=php]$(document).ready(function() {
$(‘#video1’).click(function(e) { // Button activating modal
$(‘#modal’).reveal({ // item to be opened
animation: ‘fade’, // for reveal.js
animationspeed: 600,
closeonbackgroundclick: true,
});
return false;
});
});