jQuery插件实现适用于移动端的地址选择器(2)

navBar.on("touchmove", function (e) { e.preventDefault(); var touch = e.originalEvent.touches[0]; var pos = {"x": touch.pageX, "y": touch.pageY}; var x = pos.x, y = pos.y; $(this).find("a").each(function (i, item) { var offset = $(item).offset(); var left = offset.left, top = offset.top; if (x > left && x < (left + width) && y > top && y < (top + height)) { location.href = item.href; that.changeLetter($(item).html()); } }); });

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgwywx.html