Results 1 to 5 of 5

Thread: jQuery's bind 'click' not work on mobile Safari (but work in ST1)

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1

    Default jQuery's bind 'click' not work on mobile Safari (but work in ST1)

    REQUIRED INFORMATION

    Ext version tested:

    • Sencha Touch 2.0 commercial
    Browser versions tested against:
    • Safari 5.1.4 on Windows
    • Safari on iOS 5.0.1 (iPad2 & iPhone4s)
    DOCTYPE tested against:
    • ____
    Description:
    • jQuery .bind('click') event no longer work on tested mobile Safari but it still works on Windows Safari.
    • The same codes work for both mobile and Windows Safari if using Sencha Touch 1
    Steps to reproduce the problem:
    • See Attached sample code
    • On mobile Safari, turn on Debug mode for Safari in Settings
    • index1.html uses Sencha Touch 1 while index2.html uses Sencha Touch 2
    • according to the index files, please place ST1 and ST2 library there followed the name
    The result that was expected:
    • Console logged 'clicked'
    The result that occurs instead:
    • Nothing appear in console
    Test Case:

    [CODE] <<insert working code to reproduce the report >>[/CODE

    ]HELPFUL INFORMATION

    Screenshot or Video:

    • none
    See this URL for live test case: http://Debugging already done:
    • none
    Possible fix:
    • not provided
    Additional CSS used:
    • only default ext-all.css
    • custom css (include details)
    Operating System:
    • Windows 7
    • iOS 5.0.1
    Attached Files Attached Files

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    You don't need to use jQuery to have a click (should be tap) listener. Try without using jQuery
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default

    Thanks!

    I have 14 buttons (DOM elements ) which needed to be later added tap listener? How could I accomplish this? Use ComponentQuery to collect all elements and then bind with on() ?

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    ComponentQuery would work if you are using Sencha Touch buttons
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  5. #5

    Default

    They are not Sencha Touch buttons, indeed they are <div>s

    I tried

    <div class="btn" style="margin:10px;padding:5px;background:yellow" onclick="console.log(\'clicked\')">

    for 'html' of Panel.

    It still only work on Windows Safari, but nothing triggered on mobile Safari. However, with Sencha Touch 1 it works perfectly.

    For ST2, the only solution is to add both events:-

    <div class="btn" style="margin:10px;padding:5px;background:yellow" onclick="console.log(\'clicked\')" ontouchstart="console.log(\'clicked\')">

    Hence, jQuery's event binding actually works but have to do it twice
    $('.btn').bind('click', function(){console.log('clicked')});
    $('.btn').bind('touchstart', function(){console.log('clicked')});

    Will you restore this ST1 behavior to ST2 please?

Posting Permissions

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