• I’m having issues with the iPad not behaving properly.

    On this page:
    https://entreedestinations.dreamhosters.com/trip/ultimate-rockies-by-rail/
    halfway down the page, I have a series of images, Days 1-2, Days 4-5…
    These are clickable and open a fancy box.

    I don’t want this fancybox to open up on tablets or mobile, so in the code, I added:

    <?php if( !is_handheld() ){ ?>
    	<a href="<?php echo $image_url; ?>">
    <?php } ?>

    I also tried ( !is_mobile() || !is_tablet() )
    and the conditional is on the closing </a> of course.

    For some reason, the phone works, but I can’t get the iPad to work.

    The weirdest thing is that when I put

    <?php if(is_handheld()) { echo "non desktop";} ?>
    near the top of the slideshow, that statement appears… so it should work, no?

    https://www.ads-software.com/plugins/mobble/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Christine Rondeau

    (@crondeau)

    I think that the issue here had to do with Fancy box. It was making a div a link regardless of the code. I figured out a work around and it’s now working.

    Plugin Author Scott (@scottsweb)

    (@scottsweb)

    Excellent. I would be interested to see the code for the final solution if you get a few seconds.

    It is also worth noting that if you intend to cache your website this sometimes causes inconsistent behaviour. e.g. a cached mobile version may be shown to a desktop user – it all depends on how caching is setup.

    Will mark as resolved but let me know if there are more issues.

    Thread Starter Christine Rondeau

    (@crondeau)

    Thanks Scott,

    The first thing I did was set a conditional in my functions.php file like so:

    if(!is_handheld()) {
    		wp_enqueue_script( 'fancybox', get_template_directory_uri() . '/js/min/jquery.fancybox.js', false, '20140429', true );
    	}

    Then in my single-trip.php I made another conditional like so:

    <?php if( is_handheld() ) : ?>
    
    	<?php get_template_part( 'inc/slideshow-handheld' ); ?>
    
    <?php else : ?>
    
    	<?php get_template_part( 'inc/slideshow' ); ?>
    
    <?php endif; ?>

    I then duplicated the slideshow include which pulls the acf fields and then just made sure removed all the fancybox stuff from the handheld one. It’s probably a bit over the top, but, it works.

    I do agree with you though. I think that there was a caching issue on my iPad. I still have to figure out how to debug the ipad, so annoying…

    Plugin Author Scott (@scottsweb)

    (@scottsweb)

    Thanks for sharing, that all looks sane and sensible to me.

    You could try visiting https://demo.mobiledetect.net/ on your iPad to make sure the device is correctly identified. Mobble relies on this library to do device detection and it is not always perfect.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional issue for iPad’ is closed to new replies.