如何滑动整个网页?
注销并尝试单击按钮“登录”、“注册”、“您会喜欢 Tumblr 的 30 个理由”(特别有趣)。
如何制作这种幻灯片效果?
PS:我不要求提供工作代码,只是指南和建议。
UP:似乎我找到了可能的解决方案。来自 tumblr js 文件的代码。
return new Effect.Move(element, {
x: initialMoveX,
y: initialMoveY,
duration: 0.01,
beforeSetup: function(effect) {
effect.element.hide().makeClipping().makePositioned();
},
afterFinishInternal: function(effect) {
new Effect.Parallel(
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
new Effect.Scale(effect.element, 100, {
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
], Object.extend({
beforeSetup: function(effect) {
effect.effects[0].element.setStyle({height: '0px'}).show();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
}
}, options)
);
}
For example - http://www.tumblr.com
Log out and try to click buttons "Log In", "Sign up", "30 reasons why you'll love Tumblr" (especially interesting).
How to create this slide effect?
P.S: i'm not asking for provide me working code, just guidelines and advices.
UP: seems like i found the possible solution. Code from tumblr js files.
return new Effect.Move(element, {
x: initialMoveX,
y: initialMoveY,
duration: 0.01,
beforeSetup: function(effect) {
effect.element.hide().makeClipping().makePositioned();
},
afterFinishInternal: function(effect) {
new Effect.Parallel(
[ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
new Effect.Scale(effect.element, 100, {
scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
], Object.extend({
beforeSetup: function(effect) {
effect.effects[0].element.setStyle({height: '0px'}).show();
},
afterFinishInternal: function(effect) {
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
}
}, options)
);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在这里找到全页幻灯片的工作演示:http://acarna.com/ full-page-slide.php
查看源代码和 CSS,因为这两者都是此工作所必需的。需要注意的主要关键是...
You'll find a working demo of a full-page slide here: http://acarna.com/full-page-slide.php
View the source and the CSS as both are requird for this to work. The main keys to note are...
您检查过他们在页面中使用的脚本和 CSS 吗?
只要检查一下,您就会得到如何做的线索。
Have you check out the scripts and css they have used in their pages?
just check it out you will get the clue how to do it.
我也在自己的网站上制作了这个效果。我不知道 tumblr 是怎么做到的,但我已经想出了自己的方法(以 tumblr 的效果为例):
步骤 1. 在重定向到新网址之前,将当前页面的底部部分向上滑动
步骤2.当新的url document.ready 时向下滑动顶部部分
几年后更新:
由于我刚刚获得新的投票,我发现了这个旧答案,现在有点过时了。
使用现代 JavaScript,您只需要使用
history.pushstate
,所有效果都在一个页面中执行。用js改变页面内容后,可以使用pushstate改变url,这就像是用效果导航一样。要了解有关 Pushstate 的更多信息,请参阅 https://developer .mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulated_the_browser_history
I made this effect on my own site too. I don't know how tumblr did that, but I have figured out my own way to do this(for tumblr's effect as an example):
step 1. before redirect to a new url, slide the bottom section up of current page
step 2. slide down the top section when the new url document.ready
Update years later:
Since I just got a new vote-up, I discovered this old answer which is now a little bit outdated.
With modern javascript, you just need to use
history.pushstate
, all effects are performed in one page. After changing the page content with js, you can use pushstate to change the url, which makes it like navigating with effects.To read more about pushstate, please refer https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history