Slimbox 2 specifically excludes mobile devices because (as far as I can tell) at least some, if not all of its features do not work well on mobiles. Now, the code in the thread that you linked to removes this explicit exclusion, but makes no attempt at making Slimbox 2 work with touch events.
A tap (which is really a touchstart followed quickly by a touchend with the target elements being the same - no dragging off of the start element before the touchend occurs) is often interpreted the same as a click on mobiles, but not always.
There are lightbox type scripts that work with mobiles. It would perhaps be easiest to use one of these instead of Slimbox 2. Butif you want to stick with Slimbox 2 it might be able to be adapted. The first step though would be to see if it works on a non-mobile (a desktop or laptop). Just tried that and it works. So to see if we can get things started on mobile (more work will need to be done, but this is a test to see if it can happen at all) change in the ddphpalbum.js file:
Code:
phpimagealbum.prototype={
buildgallery:function(){
var thisalbum=this
var curimage=0
document.write('<div id="'+this.albumdivid+'">')
for (var rows=0; rows<this.dimensions[1]; rows++){
for (var cols=0; cols<this.dimensions[0]; cols++){
if (curimage<this.albumvar.images.length)
document.write('<div class="photodiv">' + phpimagealbum.routines.buildimage(this.albumvar, curimage, this.autodesc, this.showsourceorder) + '</div>')
curimage++
} //end cols loop
document.write('<br style="clear: left" />')
} //end rows loop
document.write('</div>')
var albumdiv=document.getElementById(this.albumdivid)
var alldivs=albumdiv.getElementsByTagName('div')
for (var i=0; i<alldivs.length; i++){
if (alldivs[i].className=="photodiv")
this.photodivs.push(alldivs[i])
}
phpimagealbum.routines.addEvent(albumdiv, function(e){
var e=window.event || e
var target=e.srcElement || e.target
if (target.tagName=="IMG" && target.getAttribute('data-index')){
thisalbum.onphotoclick(target, thisalbum.albumvar.images[parseInt(target.getAttribute('data-index'))][0], thisalbum.albumvar.images[parseInt(target.getAttribute('data-index'))][1])
}
}, "click")
},
to:
Code:
phpimagealbum.prototype={
buildgallery:function(){
var thisalbum=this
var curimage=0
document.write('<div id="'+this.albumdivid+'">')
for (var rows=0; rows<this.dimensions[1]; rows++){
for (var cols=0; cols<this.dimensions[0]; cols++){
if (curimage<this.albumvar.images.length)
document.write('<div class="photodiv">' + phpimagealbum.routines.buildimage(this.albumvar, curimage, this.autodesc, this.showsourceorder) + '</div>')
curimage++
} //end cols loop
document.write('<br style="clear: left" />')
} //end rows loop
document.write('</div>')
var albumdiv=document.getElementById(this.albumdivid)
var alldivs=albumdiv.getElementsByTagName('div')
for (var i=0; i<alldivs.length; i++){
if (alldivs[i].className=="photodiv")
this.photodivs.push(alldivs[i])
}
phpimagealbum.routines.addEvent(albumdiv, function(e){
var e=window.event || e
var target=e.srcElement || e.target
if (target.tagName=="IMG" && target.getAttribute('data-index')){
thisalbum.onphotoclick(target, thisalbum.albumvar.images[parseInt(target.getAttribute('data-index'))][0], thisalbum.albumvar.images[parseInt(target.getAttribute('data-index'))][1])
}
}, "click");
phpimagealbum.routines.addEvent(albumdiv, function(e){
var e=window.event || e
var target=e.srcElement || e.target
if (target.tagName=="IMG" && target.getAttribute('data-index')){
thisalbum.onphotoclick(target, thisalbum.albumvar.images[parseInt(target.getAttribute('data-index'))][0], thisalbum.albumvar.images[parseInt(target.getAttribute('data-index'))][1])
}
}, "touchstart");
},
Bookmarks