Skip to content

Instantly share code, notes, and snippets.

@robertsky123
Created May 1, 2013 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertsky123/5494787 to your computer and use it in GitHub Desktop.
Save robertsky123/5494787 to your computer and use it in GitHub Desktop.
iscroll实例
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>iScroll demo: horizontal scroll</title>
<script type="application/javascript" src="iscroll.js"></script>
<script type="text/javascript">
var myScroll;
function loaded() {
myScroll = new iScroll('scroller');
}
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
document.addEventListener('DOMContentLoaded', loaded, false);
</script>
<style type="text/css" media="all">
body,ul,li {
padding:0;
margin:0;
}
#scroller {
margin:0 auto;
width:340px;
overflow:hidden;
white-space:nowrap;
padding:0;
font-size:0;
position:relative;
height:100px;
}
#scroller ul {
list-style:none;
position:absolute;
left:0;
top:0;
}
#scroller li {
display:inline-block;
margin-right:10px;
}
#scroller li:last-child{
margin-right:0;
}
#scroller li img{
width:100px;
}
#thelist + div{
display:none!important;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="scroller">
<ul id="thelist">
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
<li><img src="1.jpg" alt="" /></li>
</ul>
</div>
<span>123</span>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment