user3691753
user3691753

Reputation: 23

Stop Float at footer Jquery

Im using this code:

  $(window).scroll(function () {
  if (($(document).height() - $(window).scrollTop()) <= 500){
      $("#content-5").css({
          position: 'fixed',
          top: 'auto',
          bottom: '300px'
      });
  } else if ($(window).scrollTop() >= 30) {
      $("#content-5").css({
          position: 'fixed',
          top: '30px',
          bottom: 'auto'
      });
  }else{
      $("#content-5").css({
          position: 'absolute',
          top: '30px',
          bottom: 'auto'
      });
  }

});

And this is demo

http://jsfiddle.net/Ym2Ga/75/

Its work fine, but i don't know how to do, that float elemnt stop at footer. Anyone can help?

Upvotes: 0

Views: 183

Answers (1)

Shivratna
Shivratna

Reputation: 190

I have updated you fiddle....change your first block of css as...

$("#content-5").css({ position: 'fixed', top: '0px', bottom: 'auto' });

fiiddle

Upvotes: 1

Related Questions