LeFauko
LeFauko

Reputation: 13

Zepto.js: Tap event doesn't fire

Heyo,

I'm using Zepto (zeptojs.com). This is literally my whole code:

<html>
<head>
    <title>Test</title>
</head>
<body>

    <div>Tap me!</div>

<script type="text/javascript" src="zepto.min.js"></script>
<script>
$("div").on("tap", function() {
    alert("Tapped!");
})
</script>
</body>
</html>

Running it in iPhone-Simulator on Mac, nothing happens when I tap the <div>. When I change tap to touchend, the alert will show up.

I'm obviously doing something wrong here... But what?

Upvotes: 1

Views: 5215

Answers (1)

JirkaV
JirkaV

Reputation: 1013

By default the touch module is not included into zepto dist. You can link the file, or you can make your own build with the touch module added.

Simply clone the source from github and edit the makefile. The list of the modules in in target.built section.

...
target.build = ->
  cd __dirname
  mkdir '-p', 'dist'
  modules = (env['MODULES'] || 'zepto detect event ajax form fx touch').split(' ')
  module_files = ( "src/#{module}.js" for module in modules )
  ...

Upvotes: 1

Related Questions