Last active
August 29, 2015 14:04
-
-
Save alexanderchan/c179bfd1a1905eb11e0c to your computer and use it in GitHub Desktop.
Examples of focus for iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function focus() { | |
$('input').focus(); | |
} | |
$(focus); | |
$(function() { | |
$(document.body).load(focus); | |
$('#click').click(focus); | |
$('#click-timeout').click(function() { | |
setTimeout(focus); | |
}); | |
$('#mousedown').mousedown(focus); | |
$('#mousedown-timeout').mousedown(function() { | |
setTimeout(focus); | |
}); | |
$('#mouseup').mouseup(focus); | |
$('#mouseup-timeout').mouseup(function() { | |
setTimeout(focus); | |
}); | |
$('#extern-click-trigger').click(function() { | |
$('#click').click(); | |
}); | |
$('#tap').bind('tapone', function() { | |
focus(); | |
}); | |
$('#tap-triggering-click').bind('tapone', function() { | |
$('#click').click(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
Examples of focus for ios: | |
<input> | |
<p id="click">Click handler</p> | |
<p id="click-timeout">Click handler setting timeout</p> | |
<p id="mousedown">Mousedown handler</p> | |
<p id="mousedown-timeout">Mousedown handler setting timeout</p> | |
<p id="mouseup">Mouseup handler</p> | |
<p id="mouseup-timeout">Mouseup handler setting timeout</p> | |
<p id="extern-click-trigger">Clicking here will trigger click on the first 'Click Handler'</p> | |
<p id="tap">Virtual 'TAP' handler</p> | |
<p id="tap-triggering-click">Virtual 'TAP' handler triggering click on the first 'Click handler'</p> | |
<p> From <a href="http://typeof.it/30/how-to-show-the-virtual-keyboard-using-javascript-in-ios/">http://typeof.it/30/how-to-show-the-virtual-keyboard-using-javascript-in-ios/</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment