最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jquery編寫(xiě)彈出信息提示條并延時(shí)滑出動(dòng)畫(huà)實(shí)現(xiàn)示例

 更新時(shí)間:2023年08月06日 11:18:46   作者:TANKING  
這篇文章主要為大家介紹了jquery編寫(xiě)彈出信息提示條并延時(shí)滑出動(dòng)畫(huà)實(shí)現(xiàn)示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

摘要

平時(shí)編寫(xiě)一些簡(jiǎn)單的網(wǎng)站,又不想添加任何的組建和外部庫(kù),但是需要一些彈窗或者彈出信息提示條,可以自己編寫(xiě)一個(gè)簡(jiǎn)單的小組件。

簡(jiǎn)單的小組件

<!DOCTYPE html>
<html>
<head>
  <title>提示條示例</title>
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <style>
    *{
      padding: 0;
      margin: 0;
    }
    body{
      background: #eee;
    }
    button{
      padding: 6px 20px;
    }
    #app{
      width: 300px;
      margin:20px auto;
    }
    .notification-container {
      position: fixed;
      top: 0;
      right: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
    }
    .notification {
      background: #fff;
      color: #333;
      width: 250px;
      height: 70px;
      line-height: 70px;
      text-indent: 15px;
      border-radius: 10px;
      display: block;
      pointer-events: auto;
      margin-bottom: 10px;
    }
</style>
</head>
<body>
  <div id="app">
    <!-- 創(chuàng)建按鈕 -->
    <button onclick="createNotification()">創(chuàng)建</button>
    <!-- 提示條容器 -->
    <div id="notification-container"></div>
  </div>
  <script>
    // 計(jì)數(shù)
    let notificationCount = 0;
    // 創(chuàng)建提示條
    function createNotification() {
      // 增加提示條
      notificationCount++;
      const notificationId = `notification-${notificationCount}`;
      const notification = $(
        `<div class="notification" id="${notificationId}">提示條 ${notificationCount}</div>`
      );
      // 添加
      $("#notification-container").append(notification);
      // 延時(shí)隱藏+動(dòng)畫(huà)
      setTimeout(function() {
        $(`#${notificationId}`).slideUp(500, function() {
          $(this).remove();
        });
      }, 2000);
    }
  </script>
</body>
</html>

演示

以上就是jquery編寫(xiě)彈出信息提示條并延時(shí)滑出動(dòng)畫(huà)實(shí)現(xiàn)示例的詳細(xì)內(nèi)容,更多關(guān)于jquery彈出提示條延時(shí)滑出動(dòng)畫(huà)的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論

郧西县| 兖州市| 界首市| 金坛市| 吴堡县| 宜兴市| 丽水市| 雷州市| 吉水县| 泰宁县| 舞钢市| 北宁市| 福清市| 阜平县| 淄博市| 科技| 东山县| 仙居县| 治县。| 丁青县| 扶沟县| 崇左市| 花莲市| 乌拉特前旗| 神农架林区| 和田县| 海南省| 习水县| 定边县| 阳西县| 尉氏县| 手游| 河北区| 囊谦县| 盐亭县| 永福县| 行唐县| 固始县| 内江市| 秭归县| 长宁县|