1.效果

在该区域内,手按住拖动,该模块可上下滑动,至最顶或最底部,滑动出现空白区域将自动缩回

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUcAAAFXCAIAAAC+/RunAAAQyElEQVR4nO3d/0cuT//A8RWHRCKSiCMSOSQOOSQSR0TiiEQOkUQkEpHzn73vv+36/JAZOztf9nXN7O58rpnn46dr9+qanTvnee3svruvq2mUf//+NUM4PT09OTlJH2dpaenz8zN9nKZpzs7Ojo+P08f59u3bx8dH+jhN0/z+/fvXr1/p4ywvL7+/v6eP0zTN+fn50dFR+jgrKytvb2/p4zRNc3Fx8fPnz/RxVldXX19f08dpmuby8vLw8DB9nLW1tZeXl/Rxmqa5uro6ODhwP0fVvahagqolqDoVVUtQtQRVJ6FqCaqWoOpUVC1B1RJULUHVSahagqolMlTd+S1sbW09PDzozb29vZubG7358+fPi4sLvdmpuvNbuL293d3d1ZuPj4+bm5t68+3tbWVl5etxp+rOb2F7e/v+/l5v7u/vX19f682jo6Pz83O92am681u4u7vb2dnRm09PTxsbG3rz/f19eXn563Gn6vX19efnZ735/fv3v3//6s0fP378+fNHb/769ev37996s1P1nz9/fvz4oTf//v37/ft3vfn8/Ly+vq43Pz4+vn379vW4U/XGxsbT05Pe3NnZubu705sHBwdXV1d68/j4+OzsTG92qr6+vt7f39eb9/f329vbevPl5WVtbU1vfn5+Li0tfT3uVL25ufn4+Kg3d3d3b29v9ebh4eHl5aXePDk5OT091Zudqm9ubvb29vTmw8PD1taW3nx9fV1dXdWbNf971o+r/i1QdUPVSgH/nvXjqn8LVN1QtVLAv2f9uOrfAlU3VK0U8O9ZP676t0DVDVUrBfx7bv4pMwAL62eLLrzJPSsA8agaKA1VA6Uxql5Vcs8KQDyj6lcl96wAxGMFDpSGqoHSUDVQGqPqLSX3rADEM6p+UHLPCkC81BV49HKddT4wksGqbjx6XxgePEA+SaAqSVXbP9nZ4xtKeIjENwWgTkbVe4r9c87aw3vkSUfET9WAj1H1jdL5ofYyW7hz5glvroC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yu5ZwUgHitwoDRUDZSGqoHSGFUfKenjRr818J4CJDKqPlfSx21aHwzo1PvC3vED0ucPLK5RVuD2CE3sp5TJDxExCFCkDFXLk45Ll6pRueGrbq+97Z0zT3Xznr0b/1cIUDUqZ1R9pkQP57u+daZuP+sbM7DTPgpVo3JG1cdK+ri+C2ln8BKB8TsxUzUq17MCFybnOzP79oQ3bVQNyI14Xd3ZE84+8SjDDg4stIGrdp69JVXL197OEaga0Iyqr5SUEQOrZTvvwKvk+1mBA21G1QfKsMfIVTV5o06j/BXKjG+lB/IZ67q6vafzOP1c7TsbUzUwG/seuOSx3iO/WyaZ4VCLDmDhGFXfKcMewxlY9Mpc3ipVo05G1TtK7lkBiDfW3TIAuVA1UBqqBkpjVP2k5J4VgHhG1RtK7lkBiMcKHCgNVQOlaVf9f4JdCD4Ew0iPAAAAAElFTkSuQmCC" alt="" />

2.代码

<!DOCTYPE html>
<html>
<head>
<title>首页</title>
<style type="text/css">
.area-item {
height: 100px;
line-height:100px;
border-bottom: 1px solid #;
font-size: 50px;
}
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src='js/jquery.mobile.custom.js'></script>
<script type="text/javascript">
$(function () {
$("#AreaList").height();
$("#AreaScroll").height(); //位置偏移量=真实高度-显示高度
var endPos = $("#AreaList").height() - $("#AreaScroll").height(); if (endPos > ) {
var startY = ;
var pos = ;//真实位置
$("#AreaScroll").on("vmousemove", function (event) {
$("#AreaList").css("transform", "translateY(" + (event.clientY - startY - pos) + "px)");
}); $("#AreaScroll").on("vmousedown", function (event) {
startY = event.clientY;
});
$("#AreaScroll").on("vmouseup", function (event) {
//判断正反方向并求位移
var posi = -pos + event.clientY - startY; if (posi > ) {
pos = ;
$("#AreaList").css("transform", "translateY(0px)");
}
if (posi < && posi >= -endPos) {
pos = -posi;
$("#AreaList").css("transform", "translateY(" + posi + "px)");
}
if (posi < -endPos) {
pos = endPos;
$("#AreaList").css("transform", "translateY(" + (-endPos) + "px)");
}
});
}
});
</script>
</head>
<body> <div id="AreaScroll" style="overflow: hidden;">
<div id="AreaList" style="transform: translateY(0px);">
<div class="area-item">0级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">11级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">12级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">13级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">一级台风</div>
<div class="area-item">2级台风</div>
</div>
</div> </body>
</html>

HTML5商城开发二 通过位移实现拖动效果的更多相关文章

  1. HTML5商城开发四 多图或多商品的水平滚动展示

    一.效果图 二.实现 样式: .horz_scroll { float: left; width: 20px; height: 130px; padding-top: 100px; padding-l ...

  2. HTML5商城开发一 楼层滚动加载数据

    对于楼层加载在以前只是个想法,从来没实现过,刚好项目中碰到,再此总结一下 场景:HTML5,局部商品列表信息滚动(局部滚动条) 1.通过jq设置subCategoryScroll的高度为屏幕显示高度( ...

  3. HTML5商城开发五 实现返回页面顶部

    本文内容主要是网上参考收集,介绍四种简单的返回页面顶部代码,可以使用简单的HTML锚标记,也可使用Javascript Scroll函数动态返回等等. 一.使用锚标记返回页面顶部 使用HTML锚标记最 ...

  4. HTML5商城开发三 jquery 星星评分插件

    展示:

  5. html5游戏开发--"动静"结合(二)-用地图块拼成大地图 & 初探lufylegend

    一.前言 本次教程将向大家讲解如何用HTML5将小地图块拼成大地图,以及如何用现有的高级html5游戏开发库件lufylegend.js开发游戏. 首先让我们来了解了解如何用html5实现动画,毕竟“ ...

  6. 免费的HTML5连载来了《HTML5网页开发实例详解》连载(二)

    最近新浪.百度.腾讯.京东.大众点评.淘宝等流行的网站都加大了招聘HTML5的力度,HTML5开发人员成了抢手货,本次连载的是由大众点评前端工程师和一淘网前端工程师基情奉献的<HTML5网页开发 ...

  7. 小强的HTML5移动开发之路(13)——HTML5中的全局属性

    来自:http://blog.csdn.net/dawanganban/article/details/18179483 一.accssskey  快捷键 <!DOCTYPE HTML> ...

  8. 感谢各位亲们的大力支持,免费的HTML5学习课程《HTML5网页开发实例具体解释》连载已经结束了!

    感谢各位亲们的大力支持,免费的HTML5学习课程<HTML5网页开发实例具体解释>连载已经结束了.  有兴趣的读者能够看我的博客,也能够看以下的链接逐个学习: 当里个当.免费的HTML5连 ...

  9. HTML5移动开发学习笔记之Canvas基础

    1.第一个Canvas程序 看的是HTML5移动开发即学即用这本书,首先学习Canvas基础,废话不多说,直接看第一个例子. 效果图为: 代码如下: <!DOCTYPE html> < ...

随机推荐

  1. ThinkPHP的RBAC原理分析

    转载 http://jingyan.baidu.com/article/a948d65151a4810a2ccd2e60.html 方法/步骤 多用户对节点的操作的权限控制,这句话,经过反复扩展功能, ...

  2. 测试必备技能系列1 :通过mysql命令进行脚本数据导入

    老徐,分享测试项目中实际能解决问题的干货!   今日分享: 如何通过mysql命令行,导入mysql脚本文件数据?   ----- 解决实际的问题: 工作过程中,经常需要导入mysql脚本文件 很多同 ...

  3. ORA-00030: User session ID does not exist.

    同事在Toad里面执行SQL语句时,突然无线网络中断了,让我检查一下具体情况,如下所示(有些信息,用xxx替换,因为是在处理那些历史归档数据,使用的一个特殊用户,所以可以用下面SQL找到对应的会话信息 ...

  4. Hessian 二进制RPC协议框架

    Hessian是一个由Caucho Technology开发的轻量级二进制RPC协议. 和其他Web服务的实现框架不同的是,Hessian是一个使用二进制轻量级的Web服务协议的框架,免除了许多附加的 ...

  5. pom.xml 样例

    <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven ...

  6. 海量IT资料 + 各种平台下的Oracle安装文件 + 公开课录像 + 各种视频教程资料

    觉得老师的公开课讲的都挺好的,这里把我录的一些公开课视频分享给大家,都用的是<屏幕录像专家>来录制的,是lxe格式的,大家用这个软件来播放就可以了,后边的公开课录像文件也会慢慢添加进去的, ...

  7. oracle 数据库导出数据

    cmd导出数据: exp  ZD_ZD_ZDWW/zdzd1402!@11.111.111.213/orcl file=c:\1234.dmp owner=ZD_ZD_ZDWW

  8. Javascript字数统计

    字数统计功能,原理是给textarea添加onKeyup事件,事件读取textarea内容并获得长度,并赋值给统计字数的那个文本节点,这里有一点要注意的是添加onKeypress和onKeydown事 ...

  9. Debian Environment Variables

    原文:EnvironmentVariables General Environment variables are named strings available to all application ...

  10. [转]Oracle Form 触发器执行顺序

    Trigger 不是数据库中的触发器,不过功能类似,都是当某个事件发生的时候会触发. Trigger中可以编写代码,当对应事件发生的时候就会执行该Trigger中的代码. Oracle Form中的T ...