我試圖啓動一個自動滾動的頁面負載JScrollPane中實現。是的原因是使用錨鏈接滾動到窗格區域元素時,有很多內容似乎搞砸了滾動高度的計算。jscrollpane自動滾動文檔加載?
這裏舉例: http://sunlight.pixelalchemy.com.au/tiltrak
(後頁面加載點擊最低鏈接「底權」,你會看到這個問題)
如果使用手動滾動(拖動藍條)第一。然後使用它工作的鏈接OK。所以我想,使其在頁面加載時自動滾動到的一個元素的頂部模仿這似乎爲解決工作。 (使用autoReinitialise似乎沒有爲我工作)
這個網站似乎做一個自動滾動到我試圖複製在網站上的一類元素我工作:http://onomadesign.com/wordpress/identity-design/china-packaging-corporation/
我上網頁代碼來做到這一點:
$(function()
{
// Set up #pane4 and the links which scrollTo elements within it
var $pane4 = $('#contentPanel');
$pane4.jScrollPane({animateTo:true});
$pane4.scrollTo('.productInfo');
$('a.scroll-to-element-demo').bind(
'click',
function()
{
var targetElementSelectorString = $(this).attr('rel');
$pane4[0].scrollTo(targetElementSelectorString);
return false;
}
);
});
//left content panel slide in to appear on document ready
$(document).ready(function() {
$("#mainContent").animate({"right": "+=673px"}, "3000");
});
我也試過把它添加到文件上準備部分(在頁面JS的底部):
$("#mainContent").scrollTo('.productInfo');
兩個似乎不WO RK。
請幫幫忙,我是新手到jQuery的誰真的想解決這一個,花了SOOO太多時間,所以有這方面的幫忙,我會非常樂意接受。