首页 > 微信页面点击手机物理返回键后,页面点击事件失效?

微信页面点击手机物理返回键后,页面点击事件失效?

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

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

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

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

     ...
     //get请求

});

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


试试事件委托

【热门文章】
【热门文章】