停止浮动页脚Jquery [英] Stop Float at footer Jquery

查看:86
本文介绍了停止浮动页脚Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此代码:

  $(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'
});
}

}) / p>

这是演示


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


它的工作很好,但我不知道如何做,浮动元素停止在脚注。

解决方案

我已经更新了你fiddle ....更改你的第一个CSS块...

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



fiiddle


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?

解决方案

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

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

fiiddle

这篇关于停止浮动页脚Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆