【问题标题】:button behaved like fixed but if the parents end is visible his position :end of parent按钮表现得像固定的,但如果父母结束是可见的,他的位置:父母结束
【发布时间】:2014-11-21 12:45:12
【问题描述】:

我必须在移动设备上放置一个按钮,单击它后应该将内容移动到某个高度,并且它始终放置在页面底部,但是如果内容结尾可见,则应将其放置在末尾此内容不是页面。我该怎么做?

.button{position:fixed;}

没有答案,因为在结尾按钮隐藏了页脚。

代码很多但总之:

 <header/>
 <div id="gallery">
     <div id="paintings">
         <img/>
         <img/>
          ...
     </div>
     <div id="graphics">
         <img/>
         <img/>
          ...
     </div>
     <div id="button"><img/></div>//link or clic on div or button

</div>
<footer/>

【问题讨论】:

  • 只需编辑您的帖子并编写您的 jquery 和 html,或者创建一个 jsfiddle.net 并发布它

标签: javascript jquery html css fixed


【解决方案1】:

好的,我解决了一些问题:JSFIDDLE

我比较了

$.(window).scrollTop()

与页脚的位置:

$('footer').position().top

如果 scrollTop 值大于页脚的顶部位置,我将按钮的位置值更改为:

position: absolute

然后我将顶部值更改为页脚的顶部位置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多