开发者

Is there a way to maintain the scrollbar position On a page refresh (Without Javascript)?

I am building a system where users can edit content inline, however a requirement of the project is:

开发者_StackOverflow社区No Javascript!

Is there a way using just php, html and css to maintain the scrollbar position on a page refresh so when an edit button is clicked the page doesn't jump up to the top?

any suggestions?


This sounds like the perfect place for progressive enhancement. If there is no javascript, then use the named anchor tag (as Olli mentions) and a hash on the URL to get it close (but it won't be exact).

If there is javascript, then save the scroll position to a cookie or URL parameter and restore the scroll position exactly when the page reloads.

There should be no harm in offering the best experience you can without javascript, but offering a better one when javascript is available (progressive enhancement).

Another possibility is to use a paged or tabbed interface (to position the edit field near the top of the window) so it's a lot less likely that there is any scrolling when the field is edited.


Do it so:

<a name="jumphere"></a>

and when you have edited

http://yourUrlHere.com/somepage.php#jumphere
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜