jQuery ~ ScrollTo example

scroll in id="qqqq" div
$('#qqqq').scrollTo( { top:800, left:700}, 800 );

scroll whole body
$.scrollTo( { top:800, left:700}, 800 );

-----------------------------------code----------------------------------------------------------

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="jquery.scrollTo-min.js"></script>
<script>
function xxx()
{
$('#qqqq').scrollTo( { top:800, left:700}, 800 );
}
</script>


<button onclick="xxx()">sfsdfsdf</button>
<div id="qqqq" style="height:300px;width:500px;overflow:auto; border:1px #333 solid">
<div >gggggggggggggggggggggggggggggggggggggggggg</div>
<div >gggggggggggggggggggggggggggggggggggggggggg</div>
<div >gggggggggggggggggggggggggggggggggggggggggg</div>
<div >gggggggggggggggggggggggggggggggggggggggggg</div>
<div >gggggggggggggggggggggggggggggggggggggggggg</div>
.....................................
</div>

-----------------------------------code----------------------------------------------------------

reference
http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html

沒有留言:

發佈留言