我想做与“Scroll to”相反的操作:即,不是滚动到div,而是希望div滚动到我。 “我”是以下行的一个(Twitter的引导row
):JQuery:将元素滚动到视口
+-------------+-----------+ +-------------+-----------+
+-------------+ | +-------------+ |
+---click-----+ div | +-------------+ |
+-------------+ | +-------------+ |
+-------------+ | +-------------+ |
+-------------+-----------+ +-------------+ |
+-------------+ | +-------------+ |
+-------------+ | +-------------+ |
+-------------+ | +-------------+ |
+-------------+ | +-------------+ |
+-------------+ | +-------------+ |
+-------------+ | +-------------+-----------+
+-------------+ | +-------------+ |
+-------------+ | +---click-----+ div |
+-------------+ | +-------------+ |
+-------------+ | +-------------+ |
+-------------+-----------+ +-------------+-----------+
见,当我点击左下角行,视滚动到内容DIV之一。我想要相反的:我想要这个div(在飞行中创建一个twitter引导col-nn
,而不是可以语义上“滑动”在自己的高容器内)滚动到位。
因此,row
将不得不点击,以某种方式检测到div
是看不见的。这可能是seems;但移动div部分呢?
<div class="row">
<div class="col col-lg-12 col-sm-12">
<div class="col-md-8">
<table class="table">
<thead>
<tr>
<th>Row title</th>
</tr>
</thead>
<tbody>
<tr class="my_row">
<td>row</td>
</tr>
<tr class="my_row">
<td>row</td>
</tr>
<tr class="my_row">
<td>row</td>
</tr>
<tr class="my_row">
<td>row</td>
</tr>
<tr class="my_row">
<td>row</td>
</tr>
<!-- a lot of other rows -->
</tbody>
</table>
</div> <!-- col-md-8 -->
<div id="details" class="col-md-4 details">
<div>THIS IS THE DIV</div>
</div> <!-- col-md-4 -->
</div> <!-- col-sm-12 -->
</div>
可以发布'html','js'? – guest271314 2015-02-08 22:30:16
为什么downvote? – yPhil 2015-02-08 22:39:28
我没有downvote,但我确实读过你的问题5次,仍然不明白你想要做什么,所以这可能是一个原因。 – wojtow 2015-02-08 23:02:10