PDA

View Full Version : Lightbox mod



mitchellsimoens
14 Apr 2010, 6:53 PM
Stock Lightbox doesn't show the Prev option if it's the first image. Likewise stock doesn't show the Next option if it's the last. I think it should just jump to the start or the end and it's really simple to do:


......
initEvents: function() {
var close = function(ev) {
ev.preventDefault();
this.close();
};

els.overlay.on('click', close, this);
els.loadingLink.on('click', close, this);
els.navClose.on('click', close, this);

els.lightbox.on('click', function(ev) {
if(ev.getTarget().id == 'ux-lightbox') {
this.close();
}
}, this);

els.navPrev.on('click', function(ev) {
ev.preventDefault();
this.setImage(activeImage - 1);
}, this);

els.navNext.on('click', function(ev) {
ev.preventDefault();
if (activeImage === (images.length - 1)) {
var goTo = 0;
} else {
var goTo = activeImage+1;
}
this.setImage(goTo);
}, this);
},
......
updateNav: function(){
this.enableKeyNav();

els.hoverNav.show();
//no if then, just show
els.navPrev.show();
els.navNext.show();
},

Nothing ground breaking, just a thought to enable it.