3
這是我的第一篇文章,所以請讓我知道,如果你需要更多的信息。jQuery錨點滾動...兩個onclick事件
我正在使用分頁插件來生成頁面內容底部的鏈接。它輸出分頁鏈接如下。
<a title="Next Page" onclick="appendContent(-2);" class="next scroll" href="#top">next</a>
我也想用滾動的插件,所以頁面滾動到內容的頂部時,點擊一個鏈接分頁。該插件代碼如下...
$(document).ready(function() {
$("a.scroll").anchorAnimate()
});
jQuery.fn.anchorAnimate = function(settings) {
settings = jQuery.extend({
speed : 1100
}, settings);
return this.each(function(){
var caller = this
$(caller).click(function (event) {
event.preventDefault()
var locationHref = window.location.href
var elementClick = $(caller).attr("href")
var destination = $(elementClick).offset().top;
$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
window.location.hash = elementClick
});
return false;
})
})
}
我面臨的問題是,因爲的onclick的=「appendContent(-2);」事件,分頁產生,滾動不會工作...我需要以某種方式結合兩個點擊事件。我對jQuery沒有足夠的經驗來解決這個問題,所以我希望有人可能會提供足夠的幫助。
如果您需要更多信息,請讓我知道。
你能張貼您的分頁插件的源,它需要進行編輯,以他們 –
結合我使用這個插件的精縮版... http://rohitsengar.cueblocks.net/jquery-pagination -plugin/ 這裏有一個unminified版本... http://rohitsengar.cueblocks.net/paginator/download.php?f=paginator_dev.js 我意識到這可能是一個好多問..我認爲可能有一個簡單的解決方案。如果你需要其他東西,請告訴我。 – Palle