javascript - 微信页面点击手机物理返回键后,页面点击事件失效?
伊谢尔伦
伊谢尔伦 2017-04-11 11:48:08
0
2
410

在微信公众号站点开发过程功能中,一个页面循环绑定了点击事件,在切换到另一个页面再通过手机物理返回键返回之后,点击事件就失效了,不知是何原因?

$(function(){
  //点击事件
  var mapList=$(".map .loc-tag");
  $.each(mapList,function(index,item){
      mapList.eq(index).on('click',function(){
         ...
         //get请求
      });
  });
});
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
阿神

试试事件委托

Peter_Zhu

var hastouch = "ontouchstart" in window ? true : false,
start = hastouch ? "touchstart" : "click";

mapList.eq(index).on(start,function(){

     ...
     //get请求

});

之前我做一个项目的时候也遇到这个问题。

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!