Skip to content

Instantly share code, notes, and snippets.

@levic
Last active January 27, 2017 07:26
Show Gist options
  • Save levic/5597041 to your computer and use it in GitHub Desktop.
Save levic/5597041 to your computer and use it in GitHub Desktop.
Demonstration of double tap actionsheet behaviour in jqtouch
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/lib/jqtouch/css/jqtouch.css" />
<link rel="stylesheet" type="text/css" href="css/lib/jqtouch/extensions/jqt.actionsheet.css" />
<title>Actionsheet Demo</title>
</head>
<body>
<div id="jqt">
<!-- Home screen -->
<div id="home" class="current">
<div class="toolbar">
<h1>Home Screen</h1>
</div>
<ul class="rounded">
<li>
<a href="#testActionSheet" class="action">Show Actionsheet</a>
</li>
<li>Clicks: <span class="clicks">0</span></li>
<li>Taps: <span class="taps">0</span></li>
</ul>
</div>
<!-- action sheet -->
<div id="testActionSheet" class="actionsheet">
<div class="actionchoices">
<a href="#" class="whiteButton doMagic">Do the needful</a>
<a href="#" class="whiteButton dismiss">Cancel</a>
</div>
</div>
</div>
<script type="text/javascript" src="js/lib/cordova-2.4.0.js"></script>
<!--<script type="text/javascript" src="js/lib/zepto/zepto.js"></script>-->
<script type="text/javascript" src="js/lib/jquery-2.0.0.js"></script>
<script type="text/javascript" src="js/lib/jqtouch/jqtouch.js"></script>
<script type="text/javascript" src="js/lib/jqtouch/extensions/jqt.actionsheet.js"></script>
<script type="text/javascript">
var onReady = function() {
window.jQTouch = $.jQTouch({
useFastTouch: false,
});
$('#jqt')
.on('click', '.doMagic', function() {
console.log('click');
$('.clicks').text(parseInt($('.clicks').text())+1);
})
.on('tap', '.doMagic', function() {
console.log('tap');
$('.taps').text(parseInt($('.taps').text())+1);
})
.on('click', '.action', function() {
console.log('click open actionsheet');
})
.on('tap', '.action', function() {
console.log('tap open actionsheet');
});
};
if (window.cordova) {
document.addEventListener('deviceready', function() {
$(document).ready(onReady);
});
} else {
$(document).ready(onReady);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment