Results 1 to 5 of 5

Thread: Gallery not working properly on mobile device

  1. #1
    Join Date
    Jun 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Gallery not working properly on mobile device

    Hi, I hope you guys can help
    I used this code: http://www.dynamicdrive.com/style/cs...e-gallery/P10/
    to make this gallery: http://www.branchoutadvertising.com/apm/index2.html
    on computers it works great! LOVE IT!
    however, I tried it on my iPhone and it doesn't seem to work as well,
    I can click on an image and it will show up, however clicking out of the image is the problem...
    thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Hmm, seems OK to me. Strictly speaking, there is no hover on a mobile. However, most mobile devices fire it on touchstart. The gallery appears to work that way to me. Tap an image, see it enlarged. Tap another, it switches to that one. tap in a neutral area, and whatever image (if any) was displayed as enlarged, stops being shown that way.

    I did notice that the page 'navaigates' to #thumb - this could cause some mobile browsers to reload the page. If that's an issue, just add this short script right before the page's closing </body> tag (will not harm performance on regular computers, and might actually be beneficial there for the same reason - avoiding unintended navigation/reload):

    Code:
    <script type="text/javascript">
    ;(function(){
    	var i = 0, p;
    	while ((p = document.links[i++])){if(p.hash == '#thumb'){p.onclick=function(){return false;}}}
    })();
    </script>
    But, as I say, I believe what you're seeing is normal for hover on most touch devices, especially touch devices which do not also have a pointing device (like a mouse).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jun 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your reply!
    The issue I'm talking about:
    You click a picture and it works fine. You can click another picture and it changes pictures fine. And if you want to click a neutral area it only closes out if you click above the picture gallery. If I click the text under the gallery it won't close out.
    For example. If I click on the text "all side dumps are made of heavy duty tubing"
    Thanks for the reply and code!!

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Quote Originally Posted by lindavanruiten1 View Post
    And if you want to click a neutral area it only closes out if you click above the picture gallery. If I click the text under the gallery it won't close out.
    Confirmed here (I'm using an iPad Air).

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    OK, I'll grant that. Minor issue. Works though in iPhone 6 and iPad emulation here (neutral area below the gallery on the demo page, and your example page makes the enlarged image go away). So I cannot diagnose/help further because I don't have an actual touch device to test on. My apologies though, as I can see how this might be annoying, though not crippling. I would add that this css gallery was designed prior to wide use of touch devices. That doesn't mean it cannot possibly be improved. I'm thinking the issue I mentioned MIGHT (only might, can't be sure) enter into it. Have you tried adding the code I suggested? There's no real reason to expect it will fix the problem, but it might, as hash tags are somewhat dependent upon what part of the page one is on.

    If all else fails, you could put a span something like so above the thumbnails:

    HTML Code:
    <span style="cursor: pointer; color: navy; text-decoration: underline;">Dismiss Enlarged Image</span>
    Try the script I suggested first (if you haven't already). And make sure to refresh the page after changes to see any results.

    I have at least one other idea, so keep me posted.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Run JS On Mobile Only - not working
    By mat420 in forum JavaScript
    Replies: 2
    Last Post: 10-08-2015, 06:29 PM
  2. Resolved Making my site viewable on a mobile device
    By chadlexmorgan in forum General Paid Work Requests
    Replies: 3
    Last Post: 09-12-2013, 10:40 PM
  3. Replies: 1
    Last Post: 09-22-2011, 03:36 PM
  4. AnylinkCssMenu - drop-down pblm on mobile device
    By DonD in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 09-21-2011, 12:50 PM
  5. CMotion Image Gallery not working properly when loaded to a div
    By mechuda81 in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 05-26-2009, 04:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •