hammer.js,捏手势块子事件,如何解决呢?

时间:2016-06-20 03:24:16

标签: events hammer.js pinch

(div id =“d-cont”)使用了Pinch和Pan:

<div id="d-cont">
            <ul>
                <li>
                    <span><em id="A1-8" class="full-bin"><b>A1-8</b></em></span>
               </li>
           </ul>
       </div>

<script type="text/javascript">
$(function(){
  function show(event){
  //display text
  $('#d-cont').find('b').css('display','none');
  $(event.target).find('b').css('display','block');
  };
  //bind function
  $('.full-bin').click(function(event){show(event)});
  $('.semi-bin').click(function(event){show(event)});
  });

</script>

我这样做是为了设置hammer.Manager;

var el = document.querySelector("#d-cont");
var mc = new hammer.Manager(el);
var Pan = new hammer.Pan({ threshold: 0, pointers: 0 });
var Pinch = new hammer.Pinch({threshold: 0, pointers: 2});
Pinch.recognizeWith(Pan);
mc.add(Pan);
mc.add(Pinch);
mc.set({domEvents:true});
mc.on("panstart panmove", onPan);
mc.on("panend",onPanend);
mc.on("pinchmove", onPinch);

但是在iOS9之前永远不会调用click事件,我无法解决它,请帮忙;

0 个答案:

没有答案