Skip to content

Commit

Permalink
add a simple touch events example
Browse files Browse the repository at this point in the history
  • Loading branch information
madrobby committed Apr 7, 2012
1 parent 3fed3c1 commit dc1a70e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/touch_events.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>

<script src="../src/zepto.js"></script>
<script src="../src/event.js"></script>
<script src="../src/touch.js"></script>

<style>
.delete {
display: none;
color: red;
}
</style>

<ul id=items>
<li>List item 1 <span class=delete>DELETE</span></li>
<li>List item 2 <span class=delete>DELETE</span></li>
<li>List item 3 <span class=delete>DELETE</span></li>
<li>List item 4 <span class=delete>DELETE</span></li>
</ul>

<script>
$('#items li').swipe(function(){
$('.delete').hide()
$('.delete', this).show()
})

$('.delete').tap(function(){
$(this).parent('li').remove()
})
</script>

0 comments on commit dc1a70e

Please sign in to comment.