私は、コンテンツを(私の場合はサムネイルで)ajax(最初のhtmlに埋め込むのではなく)を介して動的に読み込むスクロールコンテンツボックスを探していました。私はこれを見つけました:http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/それは垂直にスクロールすることを除いて、私が欲しいものを正確に行います。私は本当に水平スクロールが必要です。私は危険なので十分なjavascriptだけを知っているので、私はそれを修正しようとしたすべての調整がそれを動作させていません。垂直方向のjqueryコンテンツボックスを水平方向にスクロールするように変更する
私はこのコードが好きです。なぜなら、これは追加のjsアドオンではなくjqueryライブラリを使用しているからです。
$('document').ready(function(){
updatestatus();
scrollalert();
});
function updatestatus(){
//Show number of loaded items
var totalItems=$('#content p').length;
$('#status').text('Loaded '+totalItems+' Items');
}
function scrollalert(){
var scrolltop=$('#scrollbox').attr('scrollTop');
var scrollheight=$('#scrollbox').attr('scrollHeight');
var windowheight=$('#scrollbox').attr('clientHeight');
var scrolloffset=20;
if(scrolltop>=(scrollheight-(windowheight+scrolloffset)))
{
//fetch new items
$('#status').text('Loading more items...');
$.get('new-items.html', '', function(newitems){
$('#content').append(newitems);
updatestatus();
});
}
setTimeout('scrollalert();', 1500);
}
水平にスクロールするように修正する方法はありますか?