0

私は持っている

.scroller {
    font-family : Arial,Sans-Serif;
    background : white;
    overflow-y : scroll;
    font-size  : 9.5pt; /* needed for scrollers w/o tables */
    }   

私は後で適用します

<div class="scroller">
   ... lots of content here ...
</div>

デフォルトでは、スクローラーのコンテンツの上部が表示されます。真ん中の何かにスライドしたい。

4

1 に答える 1

0

あなたのコンテンツが次のようなものであると仮定します:

<div class="scroller">
   <div id="1">
      ... lots of content here ...
   </div>
   <div id="2">
      ... lots of content here ...
   </div>
</div>

これを使用してスクロールし<div id="2">ます:

$("div.scroller").scrollTop($("#2").offset().top);

ここで例を見てみましょう: Fiddle Demo

于 2013-07-19T21:59:49.267 に答える