开发者

pause hash evaluation until initial ajax done

When someone first goes to my page, I create it from JSON using a couple of AJAX requests. I'd like to tell the browser not to try to scroll to the location in the Hash tag until after this is done (because the linked location probably won't exist yet).

Is there a way to do this?

Clarification:

mypa开发者_高级运维ge.html#l1.1.1

l1.1.1 refers to an object with id l1.1.1, that's the 'hash'


Maybe you can't tell to the browser to wait, but you can scroll again when the ajax section is loaded.

$("#blah").load("/foo/bar.php", null, function() {
    $.scrollTo($("#" + document.location.hash)
});

You'll find the ScrollTo plugin here.

Good luck!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜