/* Custom "lightbox" similar alternative - css style. */ if(typeof sircon === 'undefined' || typeof sircon.funcs === 'undefined'){ var sircon = window.sircon || {}; sircon.funcs = sircon.funcs || {}; } //CALL this function to make stuff lateboxable sircon.funcs.lateboxify = function(){ var $ = window.jQuery; //Find these suckers and make them work as a lateboxable item var targets = 'a>img', validImageEndings = ['jpg', 'jpeg', 'png', 'gif'], counter = 0; $(targets).each(function(){ $(this).attr('data-lateboxcount', counter++); }); $(targets).each(function(){ var $this = $(this), $anchor = $this.parent(), href = $anchor.attr('href'), isImageLink = false; //Verify as image link for(var i in validImageEndings){ var ending = validImageEndings[i], hrefEnd = href.substr(ending.length * -1); if(hrefEnd === ending){ isImageLink = true; break; } } //Did we verify as image link? if(!isImageLink){return;} //IS image link! $anchor.click(function(event){ event.preventDefault();//No clicky, because latebox //Remove other latebox $('body > .latebox-outer').remove(); //Add new latebox var $latebox = $('
'), $figure; //Add navigation $latebox .prepend('
') .prepend('