.load を使用してスライダーをロードする div があります。何らかの理由で、スライダーを div にロードすると、クリアできなくなります。jquery empty() 関数を使用しようとしていますが、機能しません。スライダーをロードするために使用しているjsは次のとおりです。
$("#nav").click(function() {
$("#info_header").empty();
$("#content_1").empty();
$("#content_2").empty();
$("#content_3").empty();
$("#images").empty();
$("#load_container").switchClass("load_container_port", "load_container_slider", .01);
$("#controls").switchClass("controls_port", "controls_slider", .01);
$("#info").switchClass("info_port", "info_slider", .01);
$("#load_container").css({
height:($(window).width() * 500) /1000
});
$("#info").css({
height:($(window).width() * 500) /1000
});
$("#top_section").css({
height:(($(window).width() * 500) /1000) + 40
});
setTimeout(function() {
$("#slider").delay(100).load("home_slider.html");
}, .03);
});
そして、空にして新しいコンテンツをロードするために使用しているjsは次のとおりです。
function portfolio_clear() {
$('#slider').empty();
$("#images").empty();
$("#load_container").switchClass("load_container_slider", "load_container_port", .01);
$("#controls").switchClass("controls_slider", "controls_port", .01);
$("#info").switchClass("info_slider", "info_port", .01);
}
$("#space").click(function() {
$('#load_container').css({
background: "#191919"
});
$('#close_white').css({
display: "inline-block"
});
$('#close_black').css({
display: "none"
});
$('#goto_white').css({
display: "inline-block"
});
$('#goto_black').css({
display: "none"
});
var id = $(this).attr('id');
$("#info_header").load(id + "_header.txt");
$("#content_1").load(id + "_1.txt");
$("#content_2").load(id + "_2.txt");
$("#content_3").load(id + "_3.txt");
$("<img>", {
src: "http://www.klossal.com/space.jpg"
}).appendTo("#images");
$('html, body').animate({
scrollTop: 0
}, 300);
if (screen.width >= 1025) {
$("#top_section").animate({
height: 1112
}, 300);
}
else {
$("#top_section").animate({
height: 926
}, 300);
}
});
このページは次の場所で表示できます。
"http://173.254.28.83/~klossalc/index_test.html"
左上隅にある klossal.com をクリックしてスライダーをロードできます。また、下の最初のタイルをクリックして置き換えようとすることもできますが、うまくいきません。最初にタイルをクリックすると正常に読み込まれ、次に klossal.com をクリックしてスライダーを読み込むこともできますが、その逆ではありません。