jQuery Mobile CSS打破了按钮点击事件

时间:2013-12-13 08:33:07

标签: jquery html clojure jquery-mobile-button

我正在使用Clojure和jQuery mobile编写移动网页。当我将jquery mobile CSS的链接注释掉时,网站上的所有内容都能正常工作,但是当我启用此样式表时,我的按钮都不起作用,并且没有错误可见。我确信我错过了一些简单的东西,因为这是我写的第一个移动页面,我是网络开发的新手。

<!DOCTYPE html>

<html>
<head>
  <!-- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"/> -->
  <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
  <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<!-- <body> -->
  <div data-role="page">
    <div data-role="header">
      <h1>Conwat's Game of Life</h1>
    </div>
    <div id="itr-div" height=100 width=100></div>
    <div data-role="content">
      <canvas data-role="canvas" id="surface" height=400 width=400>
      </canvas>
      <form id="options-form" name="options-form" enctype="multipart/form-data">
      <button data-role="button" type="button" class="button" id="pause-btn" value="Pause/Resume">
      </button>
      <button data-role="button" type="button" class="button" id="clear-btn" value="Clear">
      </button>
      <button data-role="button" type="button" class="button" id="heatmap-btn" value="Toggle Heatmap">
      </button>
        <!-- <input data-role="button" type="button" class="button" id="pause-btn" value="Pause/Resume">
      <input data-role="button" type="button" class="button" id="clear-btn" value="Clear">
      <input data-role="button" type="button" class="button" id="heatmap-btn" value="Toggle Heatmap"> -->

      </form>

<div data-role="footer">
  This is a footer
</div>
</html>

Clojure的:

;onclick listeners
(set-onclick! (by-id "pause-btn") #(swap! paused not)
              (println "set on click pause called"))

(set-onclick! (by-id "heatmap-btn") #(swap! show-heatmap not)
              (println "set on click heat called"))

(set-onclick! (by-id "clear-btn") #(do (swap! game-state clear-board)
                                       (swap! iteration (fn [itr] -1))
                                       (swap! game-heatmap empty-heatmap)
                                       (draw-game)
                                       (update-itr)))

提前感谢您的任何帮助。

0 个答案:

没有答案