Hammer.js Jump Start PRO

The Hammer.js JavaScript library allows us to handle gesture touch events that take place when running our code on a touch screen device.

The following code sample shows how simple it is to use this library. You just need to pass over the name of the gesture touch event you want to handle and the function you want to be invoked when that event takes place.

<!DOCTYPE html>
<html>
<head>
    <title>hammer.js demo</title>
    <script src="hammer.min.js" type="text/javascript"></script>
</head>
<body>
    <div id="something"><h1>something</h1></div>
    <script type="text/javascript">
        var element = document.getElementById('something');
        Hammer(element).on("drag", function(event) {
                                        alert("drag!");
                                    });
        Hammer(element).on("tap", function(event) {
            alert("tap!");
        });
    </script>
</body>
</html>

The following video clip overviews this code sample, shows its execution and explains it step by step.

You can find more video clips, code samples and various other training material for learning how to use this JavaScript library in my free courses web site at http://abelski.lifemichael.com.

Share:

banner for the css playlist in hebrew life michael courses for programmers

The First Steps in CSS

Learn CSS using our our videos (in Hebrew) on the CSS (he) playlist on youtube. Do it now. Do it for free.

Good Trainers Collaborate with Others

It is always essential to keep an open mind and learn from others. This applies to everyone, including teachers and especially software development trainers. Software

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences