Jelly Bean webview app does not respond to touchend events perfectly

*爱你&永不变心* 提交于 2019-11-29 10:23:33

问题


My webview app works fine with touchend events in android version older than Jelly Bean. But in Jelly Bean, the touchend events are not reliable. Especially on divs that are scrollable, the touchend events are not fired sometimes and the whole app stops responding to any touchend events and I get the Log message with the tag "webcoreglue" and text "Should not happen: no rect-based-test nodes found" Now after i scroll even little bit, it starts responding to touchend normally. Pls help.

HTML

<div id="srpanel" class="panel">
    <div class="main sr-list">
        <div class="sr-list-item-action">
        </div>
    </div>
</div>

JS

$('.sr-list-item-action').bind('touchend', function(){
//some code
});

I am using the div 'sr-list-item-action' in a for loop for each item in the list. So, clicking on an item in the list works only some times. Otherwise when it doesn't work, the whole screen is actually frozen and stops receiving any touchend events, until i scroll. Other thing i observed is, this happens more when i do a $(document).scrollTop(); when i go to the next page of the list. Not sure if this is related.


回答1:


Had the exact same problem. After many sleepless nights this saved me:

window,html,body {
    overflow-x:hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overflow: scroll !important;
}



回答2:


Change all your 'touchend' to 'click' in side your bind. This worked for me. This linked was helpful: Android WebView JellyBean -> Should not happen: no rect-based-test nodes found



来源:https://stackoverflow.com/questions/12364971/jelly-bean-webview-app-does-not-respond-to-touchend-events-perfectly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!