{"id":7815,"date":"2020-01-03T14:13:34","date_gmt":"2020-01-03T06:13:34","guid":{"rendered":"https:\/\/sdeno.com\/?p=7815"},"modified":"2020-01-03T14:50:42","modified_gmt":"2020-01-03T06:50:42","slug":"%e5%9f%ba%e4%ba%8ejquery%e5%86%99%e4%b8%80%e4%b8%aaswiper%e6%89%8b%e6%9c%ba%e8%bd%ae%e6%92%ad%e6%bb%91%e5%9d%97%e6%8f%92%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=7815","title":{"rendered":"\u57fa\u4e8ejquery\u5199\u4e00\u4e2aswiper\u624b\u673a\u8f6e\u64ad\u6ed1\u5757\u63d2\u4ef6"},"content":{"rendered":"<p>pc \u624b\u673a pc \u8f6e\u64ad \u4e8b\u4ef6 touch<\/p>\n<p><a href=\"https:\/\/sdeno.com\/wp-content\/uploads\/2020\/01\/diy_swiper\/diy_swiper.html\" target=\"_blank\" rel=\"noopener\">demo<\/a><\/p>\n<p>\u94fe\u63a5: https:\/\/pan.baidu.com\/s\/1oNZkIb821rxO42c0VHQEBg \u63d0\u53d6\u7801: 42kg<\/p>\n<p><span style=\"color: #ff0000;\">html\u5e03\u5c40<\/span><\/p>\n<figure class=\"mdx-lazyload-container\" style=\"max-width:800px\"><div style=\"padding-top:75%\"><\/div><div class=\"mdx-img-loading-sp mdui-valign\"><div><div class=\"mdui-spinner\"><\/div><\/div><\/div><img width=\"800\" height=\"600\" class=\"alignnone size-full wp-image-7817 lazyload\" title=\"\u57fa\u4e8ejquery\u5199\u4e00\u4e2aswiper\u624b\u673a\u8f6e\u64ad\u6ed1\u5757\u63d2\u4ef6\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" data-src=\"https:\/\/sdeno.com\/wp-content\/uploads\/2020\/01\/sw120190525151613728.png\" alt=\"https:\/\/sdeno.com\/wp-content\/uploads\/2020\/01\/sw120190525151613728.png\" data-srcset=\"https:\/\/sdeno.com\/wp-content\/uploads\/2020\/01\/sw120190525151613728.png 800w, https:\/\/sdeno.com\/wp-content\/uploads\/2020\/01\/sw120190525151613728-300x225.png 300w, https:\/\/sdeno.com\/wp-content\/uploads\/2020\/01\/sw120190525151613728-768x576.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\"><\/figure>\n<p>\u771f\u6b63\u6ed1\u52a8\u7684\u53ea\u6709\u7ea2\u8272\u533a\u57df\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">js\u4e8b\u4ef6<\/span><\/p>\n<p>pc\u9700\u8981<\/p>\n<p>mousedown \u9f20\u6807\u6309\u4e0b\u4e8b\u4ef6<br \/>\nmousemove \u9f20\u6807\u79fb\u52a8\u4e8b\u4ef6<br \/>\nmouseup \u9f20\u6807\u62ac\u8d77\u4e8b\u4ef6<\/p>\n<p>&nbsp;<\/p>\n<p>\u79fb\u52a8\u7aef\u9700\u8981<\/p>\n<p>touchstart \/ touchmove \/ touchend<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #ff0000;\">js\u83b7\u53d6\u5750\u6807<\/span><\/p>\n<p>JQuery\u5199\u6cd5\uff1a<\/p>\n<pre>$('#id').on('touchstart',function(e) {\r\n  var _touch = e.originalEvent.targetTouches[0];\r\n  var _x= _touch.pageX;\r\n});\r\n\r\n$('#id').on('touchmove',function(e) {\r\n  var _touch = e.originalEvent.targetTouches[0];\r\n  var _x= _touch.pageX;\r\n});\r\n\r\n$('#id').on('touchend',function(e) {\r\n  var _touch = e.originalEvent.changedTouches[0];\r\n  var _x= _touch.pageX;\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u539f\u751f\u5199\u6cd5\uff1a<\/p>\n<pre>document.getElementById(\"id\").addEventListener(\"touchstart\",function(e)\r\n{\r\n  var _x=e.touches[0].pageX;\r\n  var _y=e.touches[0].pageY;\r\n  console.log(\"start\",_x)\r\n})\r\ndocument.getElementById(\"id\").addEventListener(\"touchmove\",function(e)\r\n{\r\n  var _x=e.touches[0].pageX;\r\n  var _y=e.touches[0].pageY;\r\n  console.log(\"move\",_x)\r\n})\r\ndocument.getElementById(\"id\").addEventListener(\"touchend\",function(e)\r\n{\r\n  var _x=e.changedTouches[0].pageX;\r\n  var _y=e.changedTouches[0].pageY;\r\n  console.log(\"end\",_x)\r\n})<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u53c2\u8003\u6587\u7ae0\uff1a<a href=\"https:\/\/blog.csdn.net\/zfzhuman123\/article\/details\/90520355\" target=\"_blank\" rel=\"noopener\">https:\/\/blog.csdn.net\/zfzhuman123\/article\/details\/90520355<\/a><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n<p><audio style=\"display: none;\" controls=\"controls\"><\/audio><\/p>\n","protected":false},"excerpt":{"rendered":"<p>pc \u624b\u673a pc \u8f6e\u64ad \u4e8b\u4ef6 touch demo \u94fe\u63a5: https:\/\/pan.baidu.com\/s\/1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-7815","post","type-post","status-publish","format-standard","hentry","category-jquery"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/7815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7815"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/7815\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}