I have below code in a js file which works fine on all desktop browsers but not on the following tablet & phone
- Samsung S4 (chrome & default browser)
- iPhone 4S (chrome & safari)
On ipad air/mini (using chrome & safari) it works fine On HTC 1 (using chrome & default) it works fine
Does anyone have any ideas on this? - it seems very much device intermittent which is frustrating
var clicked = false;
$('header > div > nav > ul > li').first().find('a').on("click", function (e) {
if (clicked === false) {
clicked = true;
return true;
} else {
e.preventDefault();
e.stopPropagation();
return false;
}
});
The code is basically disabling an anchor link click event after the first click (the page reloads when user clicks it - set in href) and gets re-enabled when browser renders page again.
The code has grown to what you see above.. i originally just had e.preventDefault();
in the else block which worked fine on desktop testing until i hit the mobile devices.