小编Mor*_*ang的帖子

Jquery .live事件没有解雇

我有一个关于.live触摸事件的简单问题.我想要做的是当用户点击/触摸页面的主体(容器)时,refreshCanvas调用该函数.然而,这似乎对我没有用.

JavaScript的:

<script type="text/javascript">
  function refreshCanvas () {
    var code = document.getElementById('iframe');
    code.src = code.src; // that is the essence here
  }
  setInterval(refreshIframe1, 20000);
  function refreshIframe1() {
    $("#iframe")[0].src = $("#iframe")[0].src;
  }
  $('#container').live("tap", function() {
    refreshCanvas();
  });
</script>    
Run Code Online (Sandbox Code Playgroud)

HTML:

  <a href="javascript:refreshCanvas()"><img src="data/refresh.jpg"></a>
  <div id="container">  
    <iframe id="iframe" src="data/canvas.html"  z-index: 0; style="border: 0; position:absolute; top:0; left:0; right:0; bottom:0; width:100%; height:100%"></iframe> 
  </div>
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-mobile

2
推荐指数
1
解决办法
1063
查看次数

标签 统计

javascript ×1

jquery ×1

jquery-mobile ×1