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:

The Visitor Design Pattern

The Visitor Design Pattern

The visitor design pattern allows us to add operations to objects that already exist without modifying their classes and without extending them.

What are Anti Patterns?

Anti Patterns

Unlike design patterns, anti patterns just seem to be a solution. However, they are not a solution and they cause additional costs.

Virtual Threads in Java Professional Seminar

Virtual Threads in Java

The use of virtual threads can assist us with improving the performance of our code. Learn how to use virtual threads effectively.

The Beauty of Code

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

Update cookies preferences