Skip to content

Instantly share code, notes, and snippets.

@navio
Created August 11, 2014 04:54
Show Gist options
  • Save navio/c6eb1ba54a9fff0a0993 to your computer and use it in GitHub Desktop.
Save navio/c6eb1ba54a9fff0a0993 to your computer and use it in GitHub Desktop.
Example of Gestures for Touch Devices
.pinch{background-color:yellow}
.tap{background-color:lightblue}
.hold{background-color:lightgreen}
.small-square
{
border: 1px solid black;
display:inline-block;
width:130px;
height:130px;
margin-left:30px;
position: relative
}
.small-square a{
display:block;
width:100%;
height:130px;
line-height: 100px;
border: 1px solid blue;
}
.small-square div
{
font-size: 20px;
text-align:center;
}
.container{
width: 100%;
height: 150px;
//border: 1px solid red;
margin-top:50px;
padding:0px;
white-space:nowrap;
overflow:scroll
}
body{
margin:0px; padding:0px;
}
.whole{
border: 1px solid gray;
background-color:white;
position:fixed;
width: 100%;
height: 400px;
top:1px;
left:2px;
display:none;
}
.whole p { text-align:center; }
.whole h1 {
font-size: 45px;
text-align:center;
padding-top:140px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Example of Gestures to expand content." />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta charset="utf-8">
<script src="//cdn.jsdelivr.net/quojs/2.3.1/quo.debug.js"></script>
<title>JS Bin</title>
</head>
<body>
<ul class="container">
<li class="small-square pinch">
<div>
<a href="http://yahoo.com">
Pinch Out
</a>
</div>
</li>
<li class="small-square tap">
<div>
<a href="http://yahoo.com">
Double Tap
</a>
</div>
</li>
<li class="small-square hold">
<div>
<a href="http://yahoo.com">
Hold
</a>
</div>
</li>
</ul>
<div class="whole">
<h1>Message</h1>
<p>Tap to close me</p>
</div>
</body>
</html>
$$('.pinch').pinchOut(function(ev){
$$('.whole').show();
ev.preventDefault();
});
$$('.tap').doubleTap(function(ev){
$$('.whole').show();
ev.preventDefault();
});
$$('.hold').hold(function(ev){
$$('.whole').show();
ev.preventDefault();
});
$$('.whole').tap(function(ev){
$$('.whole').hide();
ev.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment