app/template/default/Block/float_1yen_banner.twig line 1

Open in your IDE?
  1. {% block stylesheet %}
  2.     <style>
  3.     /* バナー全体のスタイル */
  4.     .float_btn {
  5.         width: 200px;
  6.         height: 200px;
  7.         position: fixed;
  8.         right: 25px;
  9.         bottom: 25px;
  10.         z-index: 500;
  11.     }
  12.     .float_btn img {
  13.         width: 200px;
  14.     }
  15.     /* クローズボタンのスタイル */
  16.     .close-btn {
  17.         position: absolute;
  18.         top: -10px;
  19.         right: -10px;
  20.         background-color: #000000; /* 赤い背景色 */
  21.         color: #ffffff; /* 白い文字 */
  22.         border: none;
  23.         border-radius: 50%;
  24.         width: 30px;
  25.         height: 30px;
  26.         font-size: 18px;
  27.         font-weight: bold;
  28.         cursor: pointer;
  29.         line-height: 30px;
  30.         text-align: center;
  31.     }
  32.     .close-btn:hover {
  33.         background-color: #000000; /* ホバー時の色 */
  34.     }
  35.     </style>
  36. {% endblock %}
  37. {% block javascript %}
  38.     <script>
  39.         document.addEventListener("DOMContentLoaded", function () {
  40.             const banner = document.getElementById("banner");
  41.             // セッションストレージに閉じた情報があるか確認
  42.             const isClosed = sessionStorage.getItem("bannerClosed");
  43.             // フラグが無ければ(未閉じ状態なら)表示する
  44.             if (isClosed !== "true") {
  45.                 banner.style.display = "block";
  46.             }
  47.         });
  48.         function closeBanner() {
  49.             const banner = document.getElementById('banner');
  50.             banner.style.display = 'none';
  51.             sessionStorage.setItem("bannerClosed", "true");
  52.         }
  53.     </script>
  54. {% endblock %}
  55. <div class="float_btn" id="banner" style="display: none;">
  56.     <a href="{{ url('user_data', { 'route': '1yen_2025_lp' }) }}">
  57.         <img src="{{ asset('assets/img/common/float_banner_1yen.png', 'user_data') }}" alt="1円キャンペーン" style="">
  58.     </a>
  59.     <button class="close-btn" onclick="closeBanner()">×</button>
  60. </div>