shake

Tutorials of (Shake) by Jacob tan

<!DOCTYPE html>
<html >
<head>
  <meta charset="UTF-8">
  <title>shake</title>
  
  
  
  
  
</head>

<body>
  <span id="message">Banana</span>
<script type="text/javascript" src="https://cdn.rawgit.com/alexgibson/shake.js/master/shake.js"></script>
<script> 
//listen to shake event
    var shakeEvent = new Shake({threshold: 15});
    shakeEvent.start();
    window.addEventListener('shake', function(){
        alert("Shaked");
var div = document.getElementById('message');

div.innerHTML = div.innerHTML + 'Shaked';
      
    }, false);

    //stop listening
    function stopShake(){
        shakeEvent.stop();
    }

    //check if shake is supported or not.
    if(!("ondevicemotion" in window)){alert("Not Supported");}
</script>
  
  
</body>
</html>
/* Downloaded from https://www.codeseek.co/ */
/* Downloaded from https://www.codeseek.co/ */

This awesome code ( shake ) is write by Jacob Tan, you can se more from this user in the personal repository

You can find the original code on Codepen.io

2018 © Jacob Tan