Shaun Shaun - 4 months ago 30
jQuery Question

Fixed sidebar on scroll

I've attempted to set a sidebar as a fixed position when it hits the top of the screen and then when it reaches the footer at the bottom it gets removed. The problem is when the user scrolls back up it's not smooth and jumps back to the top.

Can someone look at this for me please and guide me to how to make it smoother?

Link to page:
http://www.bluemoontesting.co.uk/redplug/blown-loft-insulation/

Answer

It looks as though you're using Bootstrap, so why not use their built-in affix plugin?

http://getbootstrap.com/javascript/#affix