开发者

JQuery Layout cookies scroll problem

I'm having a really weird problem with JQuery Layout. Maybe anyone开发者_运维百科 has resolved before... Sometimes, the entire screen is scrolled up. It means the bottom line in the browser now appears at the middle of the screen (more or less). After that, every time I refresh (CTRL-R) the screen stay scrolled.

I have tried to remove cookies and refresh and the problem dissapear. So I though that the problem definitively dissapear if disable Jquery Layout cookies (useStateCookie: false) but then the problem continues...

Sorry I can't give you a JSFiddle demo, because it's even difficult to reproduce in my own system. Any idea?


I've seen it before, but no idea whether you'll have the same issue causing it for you! Certainly can't understand why it would be affected by cookies. I tracked it down to the scrollIntoView javascript function.

function ScrollToId(id)
{
  elm=document.getElementById(id);
  elm.scrollIntoView();
}

In our case, the id passed in would be a div for an error message, that was at the top of the main body section of the page (below a non-scrolling menu bar, and above a non-scrolling status bar).

As with your problem, just once in a while it all went wrong, and seemed to scroll the non-scrolling elements off the top of the page, such that the error div was the new page top. Eventually gave up on a generic fix and replaced with a more hardcoded version, that just scrolls a specific page element:

function ScrollToErrors()
{
  $('#div_inside_body').scrollTop(0);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜