簡體   English   中英

Sweet Alert 2,自定義按鈕

[英]Sweet Alert 2, custom buttons

我在我的甜蜜警報中添加了 2 個自定義按鈕,但它們的功能不起作用,你能建議我解決這個問題嗎?

 //Custom buttons html: '<button id="prev-btn" class="btn btn-warning"><i class="fas fa-angle-left fa-3x"></i></button>' + '<button id="next-btn" class="btn btn-primary"><i class="fas fa-angle-right fa-3x"></i></button>', //Functions for them $("#next-btn").on("click", function() { if(currentMarineKnotIndex+1 == receivedArray.length){ currentMarineKnotIndex = 0; } else{ currentMarineKnotIndex++; } $(".nautical-knot-title").html(receivedArray[currentMarineKnotIndex].nameLV+"<br>"); $(".nautical-knot-desc").html(receivedArray[currentMarineKnotIndex].descriptionLV); $("#modal-header-div").css("background", "url('../Images/uploads/"+receivedArray[currentMarineKnotIndex].Image+"')"); }); $("#prev-btn").on("click", function() { if(currentMarineKnotIndex == 0){ currentMarineKnotIndex = receivedArray.length - 1; }else{ currentMarineKnotIndex--; } $(".nautical-knot-title").html(receivedArray[currentMarineKnotIndex].nameLV+"<br>"); $(".nautical-knot-desc").html(receivedArray[currentMarineKnotIndex].descriptionLV); $("#modal-header-div").css("background", "url('../Images/uploads/"+receivedArray[currentMarineKnotIndex].Image+"')");

此鏈接(官方網站)可能有用-> https://sweetalert.js.org/guides/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM