Swipe and hide a DOM element with jQuery Mobile

A simple example of swiping and hiding an element using the jQuery Mobile.
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="jQuery example for Tizen"/>
    
    <title>jQuery Mobile example for Tizen</title>
    
    <link rel="stylesheet" href="./css/jquery.mobile-1.3.2.css"/>
 
    <script type="text/javascript" src="./js/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="./js/jquery.mobile-1.3.2.js"></script>

    <style>
        div {
            background-color: red;
            width: 500px;
            height: 50px;
            top: 20px;
            left: 20px;
        }
    </style>
</head>

<body>

    <div>****** SWIPE ME FROM ANY DIRECTION! ******</div>
	
<script>

$('div').bind('swipe', handler);

function handler(event) {

	$(this).hide();
	
}
	    
</script>

</body>
</html>

Responses

0 Replies