私はいくつかの助けが必要です。私が構築した画像ビューアの次のボタンの画像をどのようにプリロードするか分からないようです。私は、mysqlデータベースから画像ソースを取得し、次のボタンが押されるたびにそれらを反復処理しています。どのようにこれらをプリロードできますか?次のボタンのコードは次のとおりです。jqueryでmysqlの画像をプレロードする
$("#next").click(function(){
$(h).empty();
var p = <?php echo json_encode($results); ?>;
var start = $("#intabdiv img").attr("class");
var next = p[($.inArray(start, p) + 1) % p.length];
//Checking the ID of thumbnail pictures and determining the id here
var hinext = "../php/admin/portfolio/before/"+next;
$("#intabdiv img").attr('src',hinext);
$("#intabdiv img").attr('class',next);
//Centering image on screen
var h = $("#intabdiv img").width() + 70;
//ww is defined beforehand and is the windows width.
var total = ww - (h/2);
$(".popupbox").css("margin-left", total);
});
「var p」の内部はどうなっていますか?今すぐ推測するのは難しい。 –
これは単純な配列です(image1.jpg、image2.jpg、image3.jpg)。ありがとう – liveandream