jQuery Tap Event

In this example below you will see how to do a jQuery Tap Event with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by daveontrak, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright daveontrak ©

Technologies

  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>jQuery Tap Event</title>
  
  
  
  
  
</head>

<body>

  <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

<div data-role="page" id="pageone">
  

  <div data-role="main" class="ui-content">
    <p>If you tap me, I will disappear.<br><br>
<img src = "http://media.digitalcameraworld.com/wp-content/uploads/sites/123/2012/03/Landscape_photography_tips.corbis42_24888190.jpg">

</p>
    
  </div>

  
</div>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/daveontrak/jquery-tap-event-RWBvvq */
$(document).on("pagecreate","#pageone",function(){
  $("p").on("tap",function(){
    $(this).hide();
  });                       
});

Comments