0
我有一個線性列表的圖像(垂直),我搜索使用鍵盤向上導航到下一個或prev圖像。 我的問題是,我不知道我在滾動的位置,以及我需要滾動到何處去轉到下一個或上一個圖像。跳轉到下一個&prev圖像(垂直滾動)與jQuery
我看到this example但它是水平的。我試圖讓它垂直,但沒有成功...
我也試過一些事情與inView jQuery插件,沒有成功。 一些啓動:
$("body:not(.photo) #images img").each(function() {
$(this)
.css({cursor: "pointer"})
.on("click", function() {
var $n = $(this).next(),
offset = ($n.length) ? $n.offset().top : 0;
scrollTo(offset);
});
});
// http://jsfiddle.net/JjhUN/5/
var elems = [];
$("#images").children().each(function() {
elems.push(this.offsetTop);
});
console.log(elems);
我想類似的東西,但不可能得到的功能代碼O_O。 非常感謝! – flks
我很高興我能提供幫助。 ;)如果這是解決您的問題,請標記爲接受的答案:) –