<tfoot id="xud8h"><abbr id="xud8h"></abbr></tfoot>

<em id="xud8h"><em id="xud8h"></em></em>

      <th id="xud8h"><progress id="xud8h"></progress></th>
      <em id="xud8h"><em id="xud8h"></em></em>

      <strong id="xud8h"><dl id="xud8h"></dl></strong>

      網(wǎng)頁版Toast彈窗如何實現(xiàn)?

      二次開發(fā) admin 發(fā)布時間:2024-11-07 07:43:15 瀏覽:
      最近通遼易聯(lián)通達應(yīng)客戶的要求,開發(fā)了一個網(wǎng)頁版的Toast彈窗。代碼跟大家分享一下。
      效果圖如下:

      功能主要是摒棄了alert彈窗,因為alert彈窗默認帶有網(wǎng)址鏈接,不太合適。
      開發(fā)步驟如下
      1.首先加載Toast相關(guān)的js庫和css庫
        <link href="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
        <script src="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
      2.在Html頁面中增加彈窗元素,默認是不顯示的。只有點擊Copy按鈕才顯示。
                <div class="toast">
                  <div class="toast-header">
                    <strong class="me-auto">Information</strong>
                    <button type="button" class="btn-close" data-bs-dismiss="toast"></button>
                  </div>
                  <div class="toast-body">
                    <p>Copy success!</p>
                  </div>
                </div>
      3. 在javascript中增加Copy按鈕的點擊事件
        var toastElList = [].slice.call(document.querySelectorAll('.toast'));
        var toastList = toastElList.map(function(toastEl) {
          return new bootstrap.Toast(toastEl)
        });
        toastList.forEach(toast => toast.show());

      歡迎大家跟我交流。
      相關(guān)推薦
        無相關(guān)信息

      在線咨詢

      點擊這里給我發(fā)消息售前咨詢專員

      點擊這里給我發(fā)消息售后服務(wù)專員

      在線咨詢

      免費通話

      24h咨詢:0475-2793529


      如您有問題,可以咨詢我們的24H咨詢電話!

      免費通話

      微信掃一掃

      微信聯(lián)系
      返回頂部
      91在线看片国产免费观看,国产成人免费在线播放,国产精品无码无卡毛片不卡视频,精品无码国产一区二区三区.漫画
      <tfoot id="xud8h"><abbr id="xud8h"></abbr></tfoot>

      <em id="xud8h"><em id="xud8h"></em></em>

          <th id="xud8h"><progress id="xud8h"></progress></th>
          <em id="xud8h"><em id="xud8h"></em></em>

          <strong id="xud8h"><dl id="xud8h"></dl></strong>