Skip to content

Commit

Permalink
test preload
Browse files Browse the repository at this point in the history
  • Loading branch information
linyisonger committed Oct 12, 2024
1 parent b03048f commit 5e6c469
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions 078.你更喜欢谁.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@
<h2>你更喜欢哪个?</h2>
<div class="pk-cards">
<div class="pk-card leftCardMoveIn">
<img src="./assets/movie-poster/m-byxz.jpg" />
<img />
<span>xxx</span>
</div>
<div class="pk-vs">VS</div>
<div class="pk-card rightCardMoveIn">
<img src="./assets/movie-poster/m-dbs.jpg" />
<img />
<span>xxx</span>
</div>
</div>
Expand All @@ -195,7 +195,7 @@ <h2>你更喜欢哪个?</h2>
let label = res.split("\n").filter((a) => a);

console.log(label);

stars = label.map((n) => {
let tmpArr = n.split("_");
return {
Expand All @@ -208,6 +208,8 @@ <h2>你更喜欢哪个?</h2>
let cardDom = document.querySelectorAll(".pk-card");
// 随机抽取10条数据
let pkStars = Randoms.getDisorganizeArray(stars).slice(0, 10);
// 预加载图片
pkStars.forEach((s) => fetch(s.img));
// 左/右卡片
let leftCardDom = cardDom.item(0);
let rightCardDom = cardDom.item(1);
Expand Down

0 comments on commit 5e6c469

Please sign in to comment.