0
我使用ajax動態地將內容添加到我的網站,但我希望頁面跳轉到內容已添加,但我無法讓我工作。添加動態內容後跳轉到頁面上的位置
這裏是我用來添加內容和跳轉位置的鏈接。
<a href="javascript:ajaxpage('/console/new_message_profile.php', 'message_area');" onclick="window.scrollTo(0, 2000);">
我使用ajax動態地將內容添加到我的網站,但我希望頁面跳轉到內容已添加,但我無法讓我工作。添加動態內容後跳轉到頁面上的位置
這裏是我用來添加內容和跳轉位置的鏈接。
<a href="javascript:ajaxpage('/console/new_message_profile.php', 'message_area');" onclick="window.scrollTo(0, 2000);">
舉一個id
到動態生成的元素,然後
$("#idofdynamicelement")[0].scrollIntoView(true);
// O to make sure its the first item if multiple found
// true to indicate the top position
看起來您可以通過使用window.scrollTo(0,2000)使頁面滾動到其底部。我試過你的代碼在我的服務器上,並且它工作正常。你能提供更多細節嗎?