如何重新定位固定标题&页脚? [英] how do i re-position fixed Header & Footer?

查看:129
本文介绍了如何重新定位固定标题&页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题,当使用固定的标题& Footer,
但是一些建议我使用Position:Absolute而不是固定
,并在使用JavaScript代码滚动时重新定位页眉和页脚,
有没有人知道如何做到这一点?
或这个问题面对他。

I have got some issues when using fixed Header & Footer, But some suggest on me to use Position: Absolute instead of Fixed and re-position Header and footer when scroll using JavaScript Code, Does any one know how to do this? Or this issue faced him.

任何建议都会有所帮助。

Any suggestion would be helpful.

推荐答案

Ahmed,我刚刚从另一个我们讨论过的线程来到这里。你的问题不够清楚,其他人回答。您的问题应该包括您需要触发javascript函数以重新定位特定事件。

Ahmed, I just came over here from the other thread we had been discussing. Your question isn't clear enough for the other folks to answer. Your question should include the fact that you need to trigger the javascript function to reposition on a specific event.

您可以这样做的一种方法是:
Change而不是固定的。不要使用固定的。然后使每次浏览器窗口滚动或完成滚动时定位元素的javacript函数。通过这样做,在用户完成滚动之后,元素将总是被移动到视图中。他们实际上会流入看起来丑陋的视图。为了使它们平滑地移动到视图中,你必须通过使用css3 transistions或者使用javascript逐渐插入位置来进一步扩展它。在iOS5和iOS6上,你应该能够使用css3转换就好了。它们将非常容易实现。 CSS3转换使javascript控制的动画成为一块蛋糕。

One way you could do this is this: Change the elments to absolute position instead of fixed. Don't use fixed at all. Then make the javacript function for positioning elements fire every time the browser window scrolls or finishes scrolling. By doing it this way, the elements will always be moved into view after user finishes scrolling. They will actually pop into view which will look ugly. To make them smoothly move into view, you'll have to extend it further by using css3 transistions OR interpolating the position gradually with javascript. On iOS5 and iOS6, you should be able to use css3 transitions just fine. They would be VERY easy to implement. CSS3 transitions make javascript controlled animations a piece of cake.

很难的部分将实现javascript来计算元素位置,然后在浏览器完成滚动后触发事件。

The hard part will be implementing the javascript to compute the element positions and then fire the event after the browser finishes scrolling.

希望如果我有正确的方向,其他一些人可能会说。

Hopefully some other folks can chime in if I've got the right direction.

bro。 :)

这篇关于如何重新定位固定标题&页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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