javascript - touchend event in ios webkit not firing? -


i'm trying implement menu ios webkit based app in user touches/clicks , holds menu button ('.menu_item'), after 500ms sub menu opens (div.slide_up_sub_menu), , user should able slide finger/mouse submenu li item , release.

    <li class="menu_item">        asset management        <div class="slide_up_sub_menu hidden_menu">          <ul class="submenu">            <li>unified naming convention</li>            <li>version control</li>          </ul>        </div>     </li> 

the application should able detect submenu item touchend/mouseup event happened on. i'm binding touchstart event menu item, waiting 500ms, , afterwards telling submenu show. when user releases finger touchend event should fire closing submenu. if user has stopped touch on submenu item should detected. detection of submenu item mouseup event happened on works in safari on desktop:

$('ul.submenu li').live('mouseup', function(e){    console.log($(e.currenttarget)); //works on desktop }); 

but if same using touchend handler doesn't work on ipad:

$('ul.submenu li').live('touchend', function(e){    console.log($(e.currenttarget)); //never fires }); 

if every touchend event can reference parent sub menu item when end touch on submenu item:

$(document.body).bind('touchend', function(e) {     console.log($(e.target).html()); //logs asset management  }); 

but no reference submenu item.

does have idea why touchend event not being fired on submenu items?

thanks

touchend not fire because touchcancel has fired earlier. if want full touch evens handling need call

e.preventdefault() 

in callback of "touchmove" event, otherwise when touchmove event occurs if browser decides scroll event fire touchcancel , never fire touchend.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -