Click through the JS traversal out of the list, jump page. Click the event delegate on the document ,
Like this: $ (document). On ("click", ". Nav", function () {})
On the Web and Android on the degree of no problem, can jump normally. But clicking on iOS doesn't have any response. The reason: event delegates oniOS cannot be bound to document and iOS, and should be bound on other parent elements of it
$.each (Dataall,function(i,item) {str+ = ' <div class= ' nav shadow-black ' data-str= ' +Item.data_str+ ' "><div class=" Nav-item ">Item.myheadimgurl+ ' "/><div class=" ellipsis ">" +Item.myusername+ ' </div></div><div class= ' nav-item alike ' ><div>VS</div><div> ' +Item.addtime+ ' </div></div><div class= "Nav-item" >Item.compareheadimgurl+ ' "/><div class=" ellipsis ">" +Item.compareusername+ ' </div></div></div> '; }); $("#shareContent"). html (str);
//iOS Click No response, no event triggered$(Document). On (' click ', '. Nav '),function(){ varDATA_STR = $ ( This). Data (' str '); Window.location.href= ' http://test.epoque.cn/user/footcompare/compare_foot?data_str= ' +data_str;})//delegate events to other elements, iOS click to jump$ ('#shareContent'). On (' click ', '. Nav '),function(){ varDATA_STR = $ ( This). Data (' str '); Window.location.href= ' http://test.epoque.cn/user/footcompare/compare_foot?data_str= ' +data_str;})
Another problem: Often in iOS a button can not point, like this <span> button </span>, the reason is the semantic problem, may use a tag or button, the solution: Add Style: Cursor:pointer.
Jquery Event Delegation fails on iOS