首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在页脚处停止浮动Jquery

在页脚处停止浮动Jquery
EN

Stack Overflow用户
提问于 2014-07-27 11:12:04
回答 1查看 179关注 0票数 0

我正在使用以下代码:

代码语言:javascript
复制
  $(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'
      });
  }

});

这是演示

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

它的工作很好,但我不知道该怎么做,浮子不能停在脚上。有人能帮忙吗?

EN

回答 1

Stack Overflow用户

发布于 2014-07-27 11:29:47

我已经向你更新了fiddle....change你的第一个css块.

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

手摇

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24980340

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档