我正在尝试从ratchet实现push.js引擎:
http://maker.github.com/ratchet/#push
我从这里下载了棘轮文件:
http://maker.github.com/ratchet/ratchet.zip
我使用apache来服务所有的js,css和html。所有文件都在同一个目录中。
这是我的one.html文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ratchet template page</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Include the compiled Ratchet CSS -->
<link rel="stylesheet" href="ratchet.css">
<!-- Include the compiled Ratchet JS -->
<script src="ratchet.js"></script>
</head>
<body>
<!-- Make sure all your bars are the first things in your <body> -->
<header class="bar-title">
<h1 class="title">one.html</h1>
</header>
<!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) -->
<div class="content">
<ul class="list">
<li>
<a href="two.html">
<strong>two</strong>
<span class="chevron"></span>
</a>
</li>
</ul>
</div>
</body>
</html>下面是我的two.html文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ratchet template page</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Include the compiled Ratchet CSS -->
<link rel="stylesheet" href="ratchet.css">
<!-- Include the compiled Ratchet JS -->
<script src="ratchet.js"></script>
</head>
<body>
<!-- Make sure all your bars are the first things in your <body> -->
<header class="bar-title">
<h1 class="title">two.html</h1>
</header>
<!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) -->
<div class="content">
<ul class="list">
<li>
<a href="one.html">
<strong>one</strong>
</a>
</li>
</ul>
</div>
</body>
</html>如何将这两个文件链接在一起?
看起来像是包含了push.js,但是当我点击a时,它什么也没做。
我觉得我在这个实现中遗漏了一些非常明显的东西。
谢谢你的帮助。
发布于 2013-01-31 16:13:16
Ratchet通过触摸事件工作,而触摸事件在您的浏览器中不可用。在Chrome中,转到chrome://flag/并启用"Force enable touch events“。这应该会对浏览器开发起到很大作用。如果你想在没有这个标志的桌面上工作,你需要一个js框架来将触摸事件转换成指针事件。像https://github.com/maker/ratchet/blob/master/docs/js/fingerblast.js这样的东西应该可以做到这一点。
发布于 2013-03-20 07:17:04
Ratchet在移动设备上使用的触摸事件与桌面浏览器中使用的指针事件不同。
您可以使用前面答案中提到的Chrome标志,也可以使用@fat的fingerblast.js将触摸事件转换为指针事件。
可以在以下位置找到fingerblaster.js文件:https://github.com/stephanebachelier/fingerblast.js
重要提示:为了启用fingerblaster.js,您需要在body元素的末尾包含一个脚本,如下所示(加载html内容后):
<script type='text/javascript'>
var fb = new FingerBlast ('body');
</script>这将创建一个新的FingerBlast对象,并在html文档的正文上设置侦听器(您可以将任何css选择器字符串放在‘body’的位置)。
发布于 2013-01-31 05:43:45
我也问了同样的问题。它似乎只能在ios /手机上运行,而不能在web浏览器上运行。
https://stackoverflow.com/questions/14573215
复制相似问题