I am unable to make changes to those external scripts, but I do have a workaround for you. The script currently references the images using the selector
$("#trigger-overlay").click(function(e)....
According to the HTML DOM spec, each ID should be unique. To work around this, you can change all the div's to have the class "trigger-overlay"
class="trigger-overlay"
Then, update the javascript code to reference the class instead of the ID
$(".trigger-overlay").click(function(e).....
By using the "." selector for classes, the click function will work for any element matching the selector. The "." selector denotes a class name.
After reviewing the actual javascript, I suggest implementing the following changes
New code for demo1.js can be found below
(function() {
var triggerBttn = document.getElementsByClassName( 'trigger-overlay' ),
overlay = document.querySelector( 'div.overlay' ),
closeBttn = overlay.querySelector( 'button.overlay-close' );
transEndEventNames = {
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd',
'transition': 'transitionend'
},
transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ],
support = { transitions : Modernizr.csstransitions };
function toggleOverlay() {
if( classie.has( overlay, 'open' ) ) {
classie.remove( overlay, 'open' );
classie.add( overlay, 'close' );
var onEndTransitionFn = function( ev ) {
if( support.transitions ) {
if( ev.propertyName !== 'visibility' ) return;
this.removeEventListener( transEndEventName, onEndTransitionFn );
}
classie.remove( overlay, 'close' );
};
if( support.transitions ) {
overlay.addEventListener( transEndEventName, onEndTransitionFn );
}
else {
onEndTransitionFn();
}
}
else if( !classie.has( overlay, 'close' ) ) {
classie.add( overlay, 'open' );
}
}
for (x=0;x<triggerBttn.length;x++) {
triggerBttn[x].addEventListener( 'click', toggleOverlay );
}
closeBttn.addEventListener( 'click', toggleOverlay );
})();
http://jsfiddle.net/a9be3/ here is the JSfiddle link for a working demo