Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, user-scalable=no" />
- <script src="https://rawgithub.com/EightMedia/hammer.js/master/hammer.min.js" type="text/javascript"></script>
- <style type="text/css">
- #box {
- height: 50px;
- width: 200px;
- padding:15px;
- background-color: #ddd;
- cursor: pointer;
- }
- #hidden {
- height: 50px;
- width: 200px;
- padding:15px;
- background-color: #ff0000;
- cursor: pointer;
- opacity: 0;
- }
- </style>
- <script>
- function setupListners() {
- var ele = document.getElementById('box'),
- subEle = document.getElementById('hidden'),
- btn = document.getElementById('btn1');
- Hammer(ele).on('hold', function(e) {
- ele.style.height = '200px';
- subEle.style.opacity = 1;
- });
- Hammer(btn).on('tap hold', function(e) {
- ele.style.height = '50px';
- subEle.style.opacity = 0;
- });
- }
- </script>
- </head>
- <body onload="setupListners()">
Advertisement
Add Comment
Please, Sign In to add comment