<style type= "Text/css" > * {margin:0; padding:0; }. min {width:350px; height:400px; Overflow:hidden; }. min ul {list-style:none; Display:block; }. Min ul li {height:30px; } </style><body> <div class= "min" > <ul> <li>21212125</li> <li>12</li> <li>343</li> <li>5345</li> <li& gt;53</li> <li>435</li> <li>ert</li> <LI>345</LI&G T <li>eg</li> <li>grrrrrr</li> <li>3453</li> <li> ret</li> <li>345</li> <li>21212125</li> <li>456</l I> <li>56</li> <li>rt</li> <li>67</li> <li>768< /li> <li>789</li> <li>dfg</li> <li>789</li> <li>21212gggggg125</li> <li>21212125</li> <li>789</li> <li>eeqqqqqqqq</li> <li>789</li> <li>gf</li> & lt;li>ttgg</li> <li>sdf</li> <li>789</li> <li>2121 2125</li> <li>dgdgdgd</li> <li>90</li> <LI>21212125&L t;/li> <li>-90</li> <li>21212125</li> <li>21212125</l i> <li>2121902125</li> <li>90-</li> <li>21212125</li& Gt <li>end</li> <li>gf</li> <li>ttgg</li> <li> sdf</li> <li>789</li> <li>21212125</li> <LI>DGDGDGD&L t;/li> <li>90</li> <li>21212125</li> <li>-90</li> <li>21212125</li> <li>21212125</li> <LI>2121902125</LI&G T <li>90-</li> <li>21212125</li> <li>end</li> <li> ;gf</li> <li>ttgg</li> <li>sdf</li> <li>789</li> ; <li>21212125</li> <li>dgdgdgd</li> <li>90</li> <li >21212125</li> <li>-90</li> <li>21212125</li> <li>21212125</li> <li>2121902125</li> <li>90-</li> <li> ;21212125</li> <li>end</li> <li>gf</li> <li>ttgg</ li> <li>sdf</li> <li>789</li> <li>21212125</li> <li>dgdgdgd</li> <li>90</li> <li>21212125</li> <li>-90</li> <li>21212125</li> <li>21212125</li> & lt;li>2121902125</li> <li>90-</li> <li>21212125</li> < ;li>end</li> <li>gf</li> <li>ttgg</li> <li>sdf< /li> <li>789</li> <li>21212125</li> <LI>DGDGDGD</LI&G T <li>90</li> <li>21212125</li> <li>-90</li> <LI>21212125&L t;/li> <li>21212125</li> <li>2121902125</li> <li>90-< /li> <li>21212125</li> <li>end</li> <li>gf</li> <li>ttgg</li> <li>sdf</li> <li>789</li> < li>21212125</li> <li>dgdgdgd</li> <li>90</li> <li> 21212125</li> <li>-90</li> <li>21212125</li> <li>2121 2125</li> <li>2121902125</li> <li>90-</li> <li>212121 25</li> <li>end9999999999999</li> </ul> </div> </body>
<script> $.fn.touchevn = function () {return This.each (function () {var $this = $ (this); var $touchtarge = $this. Children (' ul '); var _ = this; _.starty = 0; Maximum _.maxheight = $touchtarge [0].scrollheight-$this. Height (); _. Startspantime = undefined; _. lasttop = 0; $touchtarge. On (' Touchstart ', function (e) {_.starty = Event.targettouches[0].pagey; _. Startspantime = Event.timestamp; }). On (' Touchmove ', function (e) {$ (this). css ({' transition ': ' None '}); The length of the move var len = _.starty-event.targettouches[0].pagey; The final length Len = (_. Lasttop + len) *-1; $ (this). CSS (' margintop ', Len); }). On (' Touchend ', function (e) {//final stop position _. Lasttop = _. Lasttop + (_.starty-event.changedtouches[0].pagey); $ (this). css ({' transition ': ' margin 1s ', ' transition-timing-function ': ' Cubic-bezier (0.1,0.3,0.5,1) '}); if (_. Lasttop < 0) {_. lasttop = 0; $ (this). CSS (' MarginTop ', _. Lasttop); } else if (_. Lasttop > _.maxheight) {_. Lasttop = _.maxheight; $ (this). CSS (' MarginTop ', _. Lasttop *-1); } else {//deceleration drive var Endlen = _.checkspeen (event.timestamp - _. Startspantime, _.starty-event.changedtouches[0].pagey); _. Lasttop = _. Lasttop + Endlen; $ (this). CSS (' MarginTop ', _. Lasttop *-1); }}). On (' Transitionend ', function () {
if (_. Lasttop < 0) {
_. lasttop = 0;
$ (this). CSS (' MarginTop ', _. Lasttop);
} else if (_. Lasttop > _.maxheight) {
_. Lasttop = _.maxheight;
$ (this). CSS (' MarginTop ', _. Lasttop *-1);
}
}); Calculate deceleration travel distance _.checkspeen = function (t, S, maxlen) { var v = s/t; Inertia distance var len = * V/11; if (Len > MaxLen) { return maxlen; } else { return len;}} ); } $ ('. Min '). TOUCHEVN (); </script>
CSS3 HTML5 mobile device list bounce and acceleration