Ed Mozley Ed Mozley - 19 days ago 5
HTML Question

jquery sticky div gap

In my page, I have a banner div and underneath that a div which I have made sticky using the sticky-kit jquery plugin.

The sticky div should be hard up against the banner div but somehow 1 pixel is creeping in which means when you scroll the text you get a rather off-putting effect.

I've made jsfiddle here and would be very grateful for any advice. I've tried other sticky plugins for jquery and they all seem to have the same problem.

Live jsFiddle example here

HTML:

<div id="header">
<h2>Main Banner</h2>
</div>
<div id="wrapper">
<div id="left">
<h2>Menu</h2>
</div>
<div id="right">
<table id="tableHeader" width="100%" class="myTable" cellspacing="0">
<tr>
<td bgcolor="#FFFFCC"><h2>Inner Banner</h2><br>aaa</td>
</tr>
</table>
<br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a
type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of
Lorem Ipsum.
<br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a
type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of
Lorem Ipsum.
<br><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a
type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing
Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of
Lorem Ipsum.
</div>
</div>

Answer

You can make height:81px; for div#header