Need a jquery fix for ipads / iphones

Discussion in 'jQuery' started by qwikad.com, Apr 14, 2015.

  1. #1
    I use jquery to open / close divs and though it works nice on computers there's this uneasiness / jerkiness on all ipads / iphones.

    I tried different things to fix it, but nothing seems to be working.

    Anyone know how to make sliding divs work smoothly in tablets / phones?
     
    qwikad.com, Apr 14, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    what code do you use for the transition? Just show() and hide() or more complex contraptions?
     
    PoPSiCLe, Apr 14, 2015 IP
  3. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,279
    Likes Received:
    1,696
    Best Answers:
    31
    Trophy Points:
    475
    #3
    It's actually a toggle similar to this one:

    http://jsfiddle.net/wGbh5/1080/
     
    qwikad.com, Apr 14, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Hm. Haven't tested it on an iPad, but the code you linked has a completely redundant line:
    
    $(document).ready(function () {
      $(".listings").on('click', function () {
      //$(".show").not($(this).next(".show")).slideUp(300); //this is not really used at all - using slideToggle() this line is not needed
      $(this).next(".show").slideToggle(300);
      });
    });
    
    Code (markup):
    Dunno if that will affect anything on the iPad / iPhone - that might just be Safari crapping on everything, as usual
     
    PoPSiCLe, Apr 17, 2015 IP
  5. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,279
    Likes Received:
    1,696
    Best Answers:
    31
    Trophy Points:
    475
    #5
    No, no it is used. Without it the div always stays open unless you click to close it. With it you can only open one div at a time (it's essential to where I am using it).

    I tried the jquery easing, I tried adding -webkit-transform: translatez(0); to the css, but it didn't do the trick. I guess, I'll just leave it the way it is, as I am convinced that every other website that uses divs sliding up and down has the same issue on ipads.
     
    qwikad.com, Apr 17, 2015 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Maybe. You can however replace that line with this:
    $('.show').slideUp(300); instead of $(".show").not($(this).next(".show")).slideUp(300); it will do the same, just a littlebit faster.
     
    PoPSiCLe, Apr 17, 2015 IP
    qwikad.com likes this.