I've got some jQuery I'm running on a test case we're looking into, and it runs extremely slowly on our iPad 2's.
It's snappy and responsive on our desktops and laptops, though. I've tried removing all the selectors (where possible) and instead using stored references, which didn't help much.
Before that change it was http://jsfiddle.net/EEGgv/5/ while after it was http://jsfiddle.net/EEGgv/6/
Here is the current jQuery code:
$().ready(function () {
var $varSelected = 'undefined';
var $this = 'undefined';
var varPrev = '';
var varNew = '';
$('.btn').click(function () {
$this = $(this);
if ($varSelected !== 'undefined') {
// Get previous value
varPrev = $varSelected.text();
// Find value we're trying to add
varAdding = $this.attr('value');
if (varAdding == 'Clr') {
varNew = '';
} else {
varNew = varPrev + varAdding;
}
// Write new value
$varSelected.text(varNew);
}
});
$('.qtyBox').click(function () {
$this = $(this);
// Check if we've previously had a selected box
if ($varSelected === 'undefined') {
// Didn't have one before -- nothing special
} else {
// Had one selected. We need to unselect it.
$varSelected.removeClass('Selected');
}
// Select the one we have now
$varSelected = $this;
// Add formatting
$this.addClass('Selected');
// Clear value
varNew = '';
$this.text(varNew);
});
});
I have the /5/ version (pre-references) uploaded to http://test.projectdavis.com/test.html while the /6/ versoin (references) uploaded to http://test.projectdavis.com/test2.html.
Anyone have any insight?
Thanks