なぜこれが起こっているのか理解できません。別のスワイパーにネストされたスワイパーがあります(1つは垂直スクロール用、もう1つは水平用です。私を狂わせる原因は、ネストされたスワイパーを破棄する必要があるときに定義されていないことです。これが私がやっていることです:
function embedSwiper(){
var embeddedEcosystem = new Swiper('.swiper-nested', {
//Styling set in bootstrap.min.css for pagination
mode: 'vertical',
pagination: '.pagination-nested',
paginationClickable: true,
simulateTouch : true,
});
embeddedEcosystem.swipeTo(0, 500, false);
return embeddedEcosystem;
}
これによりスワイパーが作成され、次の関数に返されます。
function reInitEmbedded(){
setTimeout(function(){
embed = embedSwiper();
$(".swiper-nested").css({"height" : "0px"});
$(".swiper-nested").css({"height" : $(".internal-relations").height()});
useLocalImg();
embed.reInit();
//Set the slide height properly since it never works as intended
return embed;
}, 600);
}
ここで高さを設定する必要があります。そうしないと、スライドが適切に取り付けられません (はい、高さを計算しようとしましたが、ワークライトを使用しているため、モバイルで問題が発生していました)。
さて、ここで物事がうまくいくところです。これをクロムでテストしています(申し訳ありませんが、現時点で提供できるリンクはありません)。
//Resize cards
swiper = reinitSwiper();
innerSwiper = reInitEmbedded();
//Show info
detailsTransition();
//Hides the overlay, and empties the panels to be filled next time
//Bound calls for use when needed
$(".back-button.btn.btn-primary.pull-left").on('click', function(){
goBack(lookUpName);
innerSwiper.destroy();
swiper.destroy();
});
ご覧のとおり、swiper
機能する変数があり、正常に破棄できます。また、innerSwiper があります。残りは関係ありません。これより前は機能していたからです。私を夢中innerSwiper
にさせているのは、それが . だから私の質問は:私が未定義になり続けるのは何が間違っているのですか?undefined
returns