全屏经典上下滚动插件
js部分修改自动获取div最大值
<script type="text/javascript"> $(document).ready( function () { var speed = 800;//图片滑动速度 var maxpage = $('.container .page').size() - 1; var nowpage = 0; //给最大的盒子增加事件监听 $(".container").swipe( { swipe: function (event, direction, distance, duration, fingerCount) { if (direction == "up") { nowpage = nowpage + 1; } else if (direction == "down") { nowpage = nowpage - 1; } if (nowpage > maxpage) { nowpage = maxpage; alert("已经到最后一张了"); } if (nowpage < 0) { nowpage = 0; alert("这是第一张"); } $(".container").animate({"top": nowpage * -100 + "%"}, speed); } } ); } ); </script>
不兼容苹果手机