如何使用棘轮启用push.js ajax内容加载器 [英] how to enable push.js ajax content loader with ratchet

查看:87
本文介绍了如何使用棘轮启用push.js ajax内容加载器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从棘轮实现push.js引擎:

i am trying to implement the push.js engine from ratchet:

http://maker.github.com/ratchet/#push

我从这里下载了棘轮文件:

i downloaded the ratchet files from here:

http://maker.github.com/ ratchet / ratchet.zip

并使用apache来提供所有js,css和html。所有文件都在同一目录中。

and am using apache to serve all js, css and html. all files are in the same directory.

这是我的one.html文件:

here is my one.html file:

<!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文件:

and here is my two.html file:

<!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>

如何将这两个文件链接在一起?

how do i link these two files together?

看起来像push.js,但是当我点击一个href时什么也没做。

it looks like push.js is included but when i clicking on the a href's does nothing.

i感觉我错过了一些关于这个实现的明显的东西。

i feel like i am missing something glaringly obvious about this implementation.

感谢您的帮助。

推荐答案

Ratchet可以处理触摸事件,这些事件在浏览器中不可用。在Chrome中,转到chrome:// flags /并启用强制启用触摸事件。这应该成为浏览器开发的诀窍。如果你想在没有标志的桌面上工作,你将需要一个js框架来将触摸事件转换为指针事件。像 https://github.com/maker/ratchet/blob/master/docs/ js / fingerblast.js 应该可以解决问题。

Ratchet works off of touch events, which are not available in your browser. In Chrome go to chrome://flags/ and enable "Force enable touch events". That should do the trick for browser development. If you want to make this work on desktops without the flag you are going to need a js framework to convert touch events to pointer events. Something like https://github.com/maker/ratchet/blob/master/docs/js/fingerblast.js should do the trick.

这篇关于如何使用棘轮启用push.js ajax内容加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆