Search code examples
androidjqueryjquery-mobilemobilephotoswipe

Photoswipe not working in Chrome or Default mobile browsers


Ok so I built this mobile site, got everything in place and after the launch I found out that PhotoSwipe does not work in Chrome or the default browser for my HTC Evo. It works fine in the FF mobile browser. I think I found the problem. I am using jQuery 1.9.1 and Jquery Mobile 1.4.2. Downgrading my jQuery is not an option at this point. Has anyone else experienced this problem or have a fix?


Solution

  • I finally tracked it down. In the code-photoswipe-1.0.11.js file I had to replace...

    $(thumbEls).live('click', function(e){
    

    with...

    $(thumbEls).on('click', function(e){
    

    and...

    if (oldDisplayValue === 'none'){
    

    with...

    if (oldDisplayValue === 'none' || oldDisplayValue === ''){
    

    For some reason Chrome was returning '' for var oldDisplayValue. This may not be the proper fix but it works fine for me now.