码迷,mamicode.com
首页 > 移动开发 > 详细

html5移动端拖拽

时间:2016-05-27 18:27:30      阅读:579      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width,initial-scale=1.0" name="viewport"/>
<title>论坛列表</title>
<link href="css/Style.css" rel="stylesheet" />
</head>
<body style="background:#f8f8f8;">
<div class="p-bbs-list">
<ul>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list1.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list2.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list3.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list4.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list4.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list4.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
<li>
<div class="p-bbs-list-left"><img src="img/bbs-list4.png"></div>
<div class="p-bbs-list-right">
<p><a href="kk_luntanNR.html">XXX产品4月上线你关注了嘛?</a></p>
<div class="bbs-bm">
<div class="bbs-li-bm">
<img src="img/bbs-st.png"><span>Stvetn</span>
<img src="img/bbs-xiaoxi.png"><span>20</span>
</div>
<div class="bbs-li-bm2">
<img src="img/bbs-time.png"><span>2016-3-29</span>
</div>
</div>
</div>
</li>
</ul>
<div class="bbs_sign" id="bbsSi" draggable="true"><img src="img/bi.png">我要发帖</div>
</div>
<script type="text/javascript">
var bbsSi=document.getElementById("bbsSi");
//监听
bbsSi.addEventListener(‘touchmove‘,function(event){
//阻止默认
event.preventDefault();
//判断是否是一个手指
if(event.targetTouches.length==1)
{
//拖拽最后的位置
var touch = event.targetTouches[0];
bbsSi.style.right = 0;
bbsSi.style.top = touch.pageY + ‘px‘;    }
},false);
</script>
</body>
</html>

 

html5移动端拖拽

标签:

原文地址:http://www.cnblogs.com/xiecheng/p/5535532.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!