Make div sticky with Bootstrap
I am using Bootstrap v3 for a div that I would like to make it "sticky" after scrolling from its current position, either moved left or left.
<div id="trigger1">
<table class="nav-justified">
<tr>
<td>
Menu Area
</td>
<td>
<div class="text-right">
<div class="dropdown">
<a id="FilterDataLabel" class="btn btn-danger" data-target="#" data-toggle="dropdown" href="#" role="button">
<span aria-hidden="true" class="glyphicon glyphicon-filter">
</span> Filter Filter Menu
</a>
</div>
</div>
</td>
</tr>
</table>
</div>
+3
user1824963
source
to share
2 answers
You need to use CSS attribute position: fixed;
Check out this example: jsFiddle .
+1
Zanon
source
to share
It sounds like you want to be div
placed somewhere on your page, and when the page scrolls, div
will stick to the top. If this is correct, you can use it ... affix
.
Here is a Fiddle when it does it with sticky div
.
Try this and use what you code here.
<script>
$('.stick-top').affix({
offset: {top: 50}
});
</script>
0
AngularJR
source
to share