Hi Stephane, let me add my voice to everyone's and say thank you for your cool code but I have one problem. Pretty photo seems to freak out and does not display properly if the image is expanded on the iphone. Can any one tell me what I must do?
This event you are seeing is a browser display issue in regards to CSS elements.
The iPhone version of Safari [at least for v 3.0] pre-dates that of Safari 3.x for the Desktop -- which did not include current CSS methods/ capabilities in early 2008.
In any case - prettyPhoto and prettyGallery specifically seem to cater to desktop-based display methods.
I haven't read thru the entire No Margin For Error Site - but I from what I have seen - there is no commentary guaranteeing iPhone compatability [or for that matter Blackberry - Android - WinMo or any other mobile devices that access the web]
_____________________________________
That being said -- there are "fixes" for these occurances - many techniques [hacks] and methods or whatnot around the web.
Easiest way - add overflow:hidden to the surrounding container
Anyone see a problem with the following hack? I put the scroll and resize functions of the jquery.prettyPhoto.js inside an if statement to eliminate the behavior on an iPhone/iPad/iPod Touch. It seems to work fine in desktop browsers and stops that auto-positioning off-screen on my iPhone when you zoom in on a gallery photo. I can't test it myself on an iPad, but I imagine it does the same thing:
In case anyone needs this, I can confirm that the following change works for iPhone:
function _center_overlay(){
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) { //Do not center the verlay if this is an iphone/ipod/ipad } else { if(doresize && typeof $pp_pic_holder != 'undefined') { scroll_pos = _get_scroll(); contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
I added overflow:hidden; to the div.pp_default .pp_content CSS and did the function lmackenzie wrote. Definitely helps, but is not perfect. Now my large images don't look funky on iPads, but I lose the navigational buttons. Not sure what to change in the CSS to make them appear over the content.