开发者

jQuery - Given an animated Background-Image - How to keep the position on page reload?

I have a background image scroll on a DOM element. This works great, but when the user clicks a link to load a new page, the background image scrolling starts back at its original position...

Any clever way of making this appear more continuous so it's not jumpy? I thought about a cookie, but was concerned that would be writing much to frequently and could crash the b开发者_Go百科rowser is it's animating constantly.

Thanks


As long as you only need the information about the position if the page changes, it should be sufficient if you write the cookie only if the onunload-event of the window fires.


How about only write the cookie when a link is pressed?


You could only update the cookie every five seconds, and in the unload event.

However, I don't think there's anything wrong with updating it more frequently; try it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜