有没有办法记住用户在文档中的最后位置? [英] Is there a way to remember a users last position in the document?

查看:60
本文介绍了有没有办法记住用户在文档中的最后位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你有一个非常长的页面并且你想要启用

用户(据说,只有一个但是如果不是这样的话) b $ b很难我们可以扩展到任何数字)没有

滚动到文档中的最后位置他/她是
查看但只是自动跳转他/她。这是否可行

使用JS?


我猜它会在附近的某处:

- 记住每一个滚动

- 将行号保存到用户硬盘

- 下次访问时跳转到保存的行


我见过记住的页面我通过饼干所以我认为这是解决方案的良好开端,但剩下的

这个问题我很乐意得到一些帮助。 />

我已经使用Java和C ++几年了,所以

prorgamming问题不是问题。但是,我还是很难接受JS的新手。


-


V?nligen

Konrad

---------------------------------- -----------------


睡眠 - 无效人使用的东西

替代咖啡


野心 - 一个不好借口没有

足够的感觉懒惰


------ ---------------------------------------------

Suppose you got a really long page and you''d like to enable
the user (supposedly, there''s only one but if it''s not to
difficult we could extend that to any number) not to have
to scroll to the last position in the document he/she was
viewing but simply auto-jump him/her to it. Is that doable
at all using JS?

I guess it would be somewhere in the vicinity of:
- remember every scroll
- save the line number to the users HDD
- at next visit jump to the saved line

I have seen pages that "remember" me by cookies so i
guess that''s a good start for the solution but the rest of
the issue i''d love to get some help with.

I''ve worked with Java and C++ for a few years so the
prorgamming issues are not a problem. However, i''m
still rather new to JS.

--

V?nligen
Konrad
---------------------------------------------------

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy

---------------------------------------------------

推荐答案

你可以使用锚点。

http://www.askblax.com

You could use anchors.

http://www.askblax.com


Konrad Viltersten写道:
Konrad Viltersten wrote:
假设你有一个非常长的页面,你想要启用用户(据说,只有一个,但如果它不是很难,我们可以扩展那个任何数字)没有
滚动到他/她
我想它会在附近的某个地方:
- 记住每个卷轴
- 保存行号到用户硬盘
- 下次访问跳转到保存的行

我看过记住的页面我是用饼干所以我认为这是解决方案的良好开端,但其余的问题我很乐意得到一些帮助。

我'已经使用Java和C ++几年了,所以
prorgamming问题不是问题。但是,我仍然是JS的新手。
Suppose you got a really long page and you''d like to enable
the user (supposedly, there''s only one but if it''s not to
difficult we could extend that to any number) not to have
to scroll to the last position in the document he/she was
viewing but simply auto-jump him/her to it. Is that doable
at all using JS?

I guess it would be somewhere in the vicinity of:
- remember every scroll
- save the line number to the users HDD
- at next visit jump to the saved line

I have seen pages that "remember" me by cookies so i
guess that''s a good start for the solution but the rest of
the issue i''d love to get some help with.

I''ve worked with Java and C++ for a few years so the
prorgamming issues are not a problem. However, i''m
still rather new to JS.




你可以存储scrollTop和pageYOffset的值以及一个页面
$ b cookie onunload中的$ b标识符(比如文件名),当用户下次访问请求
时,将页面滚动到该位置。


有在视口中查看quirksmode - 浏览器兼容性

页面。


< URL:http://www.quirksmode.org/> (框架)


< URL:http://www.quirksmode.org/viewport/compatibility.html> (直接)

-

Fred



You could store the value of scrollTop and pageYOffset and a page
identifier (say filename) in a cookie onunload and, when the user
requests on their next visit, scroll the page to that location.

Have a poke around quirksmode in the viewport - browser compatibility
page.

<URL:http://www.quirksmode.org/> (frames)

<URL:http://www.quirksmode.org/viewport/compatibility.html> (direct)
--
Fred


askMe写道:
你可以使用锚点。



你的意思是

a)动态设置每个卷轴更改的锚点



b)锚点如< a href =" bip.html"> bip< / a>




如果a - i我想知道更多。我似乎没有找到关于该主题的任何好的

信息。如果b - 我的部分没有真正的解决方案

取决于各种原因。

无论如何,谢谢你的尝试。

- -


V?nligen

Konrad

----------------- ----------------------------------


睡觉 - 使用的东西无效的人

作为咖啡的替代品


野心 - 一个糟糕的借口没有

足够的感觉是懒惰的


--------------------------------------- ------------


Do you mean
a) dynamically set anchors that are changed at every scroll
or
b) anchors as in <a href="bip.html">bip</a>
?

If a - i''d like to know more. I don''t seem to find any good
info on that topic. If b - no really a solution for my part
depending on various reasons.

Thanks for trying, anyway.
--

V?nligen
Konrad
---------------------------------------------------

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sense to be lazy

---------------------------------------------------


这篇关于有没有办法记住用户在文档中的最后位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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