I have a rather large page showing in a UIWebView (around 150 <article>s with some text, separated in <section>s). I want to do something like this with JS (I use jQuery):
$('article').click(function() {alert('hi');});
The problem is, it takes forever to run that code (around 2 seconds from the tap, on an iPad 3).
How can I improve performance on this?
I’m using the latest version of XCode and iOS 5.1.
I used this answer‘s class
SingleTapDetector, and the following code:Then it’s easy to see if the element was an
article, or even stuff like$(e.srcElement).closest('article')(because my articles have<p>paragraphs).