Cleaning up javascript a bit
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
</div>
|
||||
</section>
|
||||
<script>
|
||||
var isTouchDevice = 'ontouchstart' in document.documentElement;
|
||||
var starturl = '/start'
|
||||
var stopurl = '/stop'
|
||||
var isTouchDevice = "ontouchstart" in document.documentElement;
|
||||
var starturl = "/start";
|
||||
var stopurl = "/stop";
|
||||
$( "#spoop" )
|
||||
.mouseup(function() {
|
||||
$.getJSON(stopurl, { }, function(data) { }); return false;
|
||||
@@ -30,18 +30,16 @@
|
||||
.mousedown(function() {
|
||||
$.getJSON(starturl, { }, function(data) { }); return false;
|
||||
})
|
||||
|
||||
$('#spoop').on('touchstart', function(){
|
||||
$("#spoop").on("touchstart", function(){
|
||||
if (isTouchDevice) {
|
||||
$.getJSON(starturl, { }, function(data) { }); return false;
|
||||
}
|
||||
});
|
||||
$('#spoop').on('touchend', function(){
|
||||
$("#spoop").on("touchend", function(){
|
||||
if (isTouchDevice) {
|
||||
$.getJSON(stopurl, { }, function(data) { }); return false;
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user