简体   繁体   中英

Fire click / touchstart event with jqTouch functionality on iPad

I'm using jqTouch for displaying my content as nested list. When user clicks on node jQuery executes ajax call to get new content and put it in list and then I programmatically execute click on ID that contains this list to perform slide. Entire code:

$.ajax({
    url : 'searchServlet',
    type : 'GET',
    data : JSON.stringify(jsonParams),
    timeout : 2000,
    dataType : "json",
    error : function(xhr, ajaxOptions, thrownError)
    {
        console.error("Ajax searchServlet " +xhr.responseText);
    },
    success : function(searchResult)
    {
        var results = $("#results_from_server");
        results.empty();
        for(i=0; i < searchResult.length; i++)
        {
            $('<li>').append(createVideoItem(searchResult[i].name)).appendTo(results);              
        }
        $('body').append('<a id="tempID" href="#next"></a>');
        $('#tempID').click();
        $('#tempID').remove();
    }

It works ok in desktop safari, but not on iPad due to click limitation.

So my questions are:

  1. is there any other war to get this ajax with slide functionality
  2. if not - how can I get $('#tempID').click(); to work on iPad?

尝试

$('#tempID').trigger('click');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM