Guest User

Without Moo

a guest
Jan 12th, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.00 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="utf-8">
  5.     <meta name="viewport" content="width=device-width, user-scalable=no" />
  6.     <script src="https://rawgithub.com/EightMedia/hammer.js/master/hammer.min.js" type="text/javascript"></script>
  7.     <style type="text/css">
  8.         #box {
  9.             height: 50px;
  10.             width: 200px;
  11.             padding:15px;
  12.             background-color: #ddd;
  13.             cursor: pointer;
  14.         }
  15.         #hidden {
  16.             height: 50px;
  17.             width: 200px;
  18.             padding:15px;
  19.             background-color: #ff0000;
  20.             cursor: pointer;
  21.             opacity: 0;
  22.         }
  23.     </style>
  24.     <script>
  25.         function setupListners() {
  26.             var ele    = document.getElementById('box'),
  27.                 subEle = document.getElementById('hidden'),
  28.                 btn    = document.getElementById('btn1');
  29.            
  30.             Hammer(ele).on('hold', function(e) {
  31.                 ele.style.height = '200px';
  32.                 subEle.style.opacity = 1;
  33.             });
  34.  
  35.             Hammer(btn).on('tap hold', function(e) {
  36.                 ele.style.height = '50px';
  37.                 subEle.style.opacity = 0;
  38.             });
  39.         }
  40.     </script>
  41. </head>
  42. <body onload="setupListners()">
Advertisement
Add Comment
Please, Sign In to add comment