پرش به محتوا

باکس شناور/کافه محمد - فراغیب

از فراغیب
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۱: خط ۱:
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">


<html lang="fa" dir="rtl">
<style>
<head>
/* فقط روی این باکس اعمال شود */
  <meta charset="UTF-8" />
.online-support-box,
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
.online-support-box *{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Vazirmatn,Tahoma,sans-serif;
}


  <title>کادر معرفی</title>
.online-support-box{
  <meta name="description" content="کافه پاتوق محمد؛ انتخابی عالی برای قهوه، نوشیدنی‌های خوش‌طعم و دورهمی در فضایی دنج و صمیمی. تجربه‌ای متفاوت از یک کافه‌گردی لذت‌بخش.">
    position:fixed;
    left:20px;
    bottom:20px;
    z-index:999999;
}


  <link rel="preconnect" href="https://fonts.googleapis.com" />
.info-box{
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    width:min(340px,calc(100vw - 30px));
  <link
    background:#BCAAA4;
     href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700&display=swap"
    border-radius:14px;
     rel="stylesheet"
    box-shadow:0 4px 18px rgba(0,0,0,.08);
  />
    padding:14px;
     position:relative;
    overflow:hidden;
    transition:.3s;
     will-change:transform,opacity;
}


  <link
.info-box.hide{
     rel="stylesheet"
     opacity:0;
     href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
     transform:translateY(15px);
  />
    pointer-events:none;
}


  <style>
.close{
     * {
    position:absolute;
      margin: 0;
    top:10px;
      padding: 0;
    left:10px;
      box-sizing: border-box;
     width:30px;
     }
    height:30px;
    border:0;
    border-radius:50%;
    background:#f3f3f3;
    color:#777;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
     transition:.3s;
}


    body {
.close:hover{
      font-family: "Vazirmatn", sans-serif;
    transform:rotate(90deg);
      background: #f5f5f5;
    background:#e7e7e7;
      padding: 20px;
}
      line-height: 1.9;
      color: #444;
    }


     /* محل قرارگیری کادر در دسکتاپ */
.info-header{
     .online-support-box {
     display:flex;
      position: fixed;
     align-items:center;
      left: 20px;
    gap:10px;
      bottom: 20px;
    margin-bottom:10px;
      z-index: 999999;
    padding-left:34px;
    }
}


    /* کادر اصلی */
.avatar{
    .info-box {
    width:52px;
      max-width: 340px;
    height:52px;
      width: 100%;
    border-radius:50%;
      background: #BCAAA4;
    background:linear-gradient(135deg,#5C3A21,#8B5E3C);
      border-radius: 14px;
    color:#fff;
      box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    display:flex;
      padding: 14px;
    align-items:center;
      position: relative;
    justify-content:center;
      overflow: hidden;
    font-size:24px;
      transition: opacity 0.3s ease, transform 0.3s ease;
    flex-shrink:0;
    }
}


    .info-box.hide {
.info-title{
      opacity: 0;
    font-size:15px;
      transform: translateY(15px);
    font-weight:700;
      pointer-events: none;
    color:#4E342E;
    }
}


    /* دکمه ضربدر */
.info-text{
    .close {
    font-size:14px;
      position: absolute;
    color:#222;
      top: 10px;
    line-height:1.9;
      left: 10px;
}
      width: 30px;
      height: 30px;
      border: none;
      background: #f3f3f3;
      border-radius: 50%;
      cursor: pointer;
      transition: 0.3s;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #777;
      font-size: 14px;
    }


     .close:hover {
.mobile-toggle{
      background: #e7e7e7;
     display:none;
      transform: rotate(90deg);
    width:56px;
    }
    height:56px;
    border:0;
    border-radius:50%;
    background:linear-gradient(135deg,#5C3A21,#8B5E3C);
    color:#fff;
    font-size:24px;
    cursor:pointer;
    box-shadow:0 5px 16px rgba(0,0,0,.2);
}


    /* بخش عنوان */
@media(max-width:600px){
    .info-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
      padding-left: 34px;
    }


    /* آیکون داخل کادر */
.online-support-box{
    .avatar {
    left:14px;
      width: 52px;
    bottom:14px;
      height: 52px;
}
      border-radius: 50%;
    background: linear-gradient(135deg, #5C3A21, #8B5E3C);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      color: #fff;
      flex-shrink: 0;
      box-shadow: 0 3px 10px rgba(44, 155, 102, 0.25);
    }


    .info-title {
.info-box{
      font-size: 14px;
    display:none;
      font-weight: 700;
}
      color: #4E342E;
      line-height: 1.8;
    }


    .info-text {
.info-box.mobile-open{
      font-size: 14px;
    display:block;
      color: #000;
    animation:show .3s;
    }
}


    /* آیکون شناور مخصوص موبایل */
.mobile-toggle{
    .mobile-toggle {
    display:flex;
      display: none;
    align-items:center;
      width: 56px;
    justify-content:center;
      height: 56px;
}
      border: none;
      border-radius: 50%;
      background: linear-gradient(135deg, #5C3A21, #8B5E3C);
      color: #fff;
      font-size: 24px;
      cursor: pointer;
      box-shadow: 0 5px 16px rgba(44, 155, 102, 0.35);
      align-items: center;
      justify-content: center;
      transition: 0.3s;
    }


    .mobile-toggle:hover {
.mobile-toggle.hidden{
      transform: scale(1.08);
    display:none;
    }
}


    /* تنظیمات موبایل */
}
    @media (max-width: 600px) {
      .online-support-box {
        left: 14px;
        bottom: 14px;
      }


      .info-box {
@keyframes show{
        display: none;
from{opacity:0;transform:translateY(15px);}
        max-width: calc(100vw - 28px);
to{opacity:1;transform:translateY(0);}
      }
}
</style>


      .info-box.mobile-open {
<div class="online-support-box">
        display: block;
        animation: showBox 0.3s ease forwards;
      }


      .mobile-toggle {
<button class="mobile-toggle" id="mobileToggle" aria-label="نمایش اطلاعات">
        display: flex;
<i class="fa-solid fa-headset"></i>
      }
</button>


      .mobile-toggle.hidden {
<section class="info-box" id="infoBox" role="complementary" aria-label="معرفی کافه">
        display: none;
      }
    }


    @keyframes showBox {
<button class="close" id="closeBtn" aria-label="بستن">
      from {
<i class="fa-solid fa-xmark"></i>
        opacity: 0;
</button>
        transform: translateY(15px);
      }


      to {
<div class="info-header">
        opacity: 1;
<div class="avatar">
        transform: translateY(0);
<i class="fa-solid fa-mug-hot"></i>
      }
</div>
    }
  </style>
</head>


<body>
<h2 class="info-title">
  <div class="online-support-box">
کافه پاتوق محمد | قهوه و نوشیدنی‌های گرم
</h2>
</div>


    <!-- آیکون مخصوص موبایل -->
<p class="info-text">
    <button
کافه پاتوق محمد با ارائه انواع قهوه، نوشیدنی‌های گرم و سرد و فضایی دنج، محیطی مناسب برای دورهمی و لحظاتی آرام و دلنشین فراهم کرده است.
      class="mobile-toggle"
</p>
      id="mobileToggle"
      aria-label="نمایش اطلاعات"
      title="نمایش اطلاعات"
    >
      <i class="fa-solid fa-headset"></i>
    </button>


    <!-- کادر معرفی -->
</section>
    <section class="info-box" id="infoBox" aria-label="معرفی استاد">
</div>
      <button class="close" id="closeBtn" aria-label="بستن">
        <i class="fa-solid fa-xmark"></i>
      </button>


      <div class="info-header">
<script>
        <div class="avatar">
const box=document.getElementById("infoBox"),
          <i class="fa-solid fa-mug-hot"></i>
btn=document.getElementById("mobileToggle"),
        </div>
close=document.getElementById("closeBtn");


        <h2 class="info-title">
const expire=86400000;
          کافه پاتوق محمد
        </h2>
      </div>


      <p class="info-text">
if(localStorage.getItem("coffeeBox")){
      تجربه‌ای متفاوت از یک کافه‌گردی لذت‌بخش.
const t=Date.now()-Number(localStorage.getItem("coffeeBox"));
      </p>
if(t<expire){
    </section>
box.style.display="none";
  </div>
btn.style.display="none";
}
}


  <script>
btn.onclick=()=>{
    const closeBtn = document.getElementById("closeBtn");
box.classList.add("mobile-open");
    const infoBox = document.getElementById("infoBox");
btn.classList.add("hidden");
    const mobileToggle = document.getElementById("mobileToggle");
};


    // باز کردن کادر در موبایل
close.onclick=()=>{
    mobileToggle.addEventListener("click", function () {
localStorage.setItem("coffeeBox",Date.now());
      infoBox.classList.add("mobile-open");
      mobileToggle.classList.add("hidden");
    });


    // بستن کادر
if(innerWidth<=600){
    closeBtn.addEventListener("click", function () {
box.classList.remove("mobile-open");
      if (window.innerWidth <= 600) {
btn.classList.remove("hidden");
        infoBox.classList.remove("mobile-open");
}else{
        mobileToggle.classList.remove("hidden");
box.classList.add("hide");
      } else {
setTimeout(()=>box.style.display="none",300);
        infoBox.classList.add("hide");
}
 
};
        setTimeout(function () {
</script>
          infoBox.style.display = "none";
        }, 300);
      }
    });
  </script>
</body>
</html>

نسخهٔ ‏۱۱ اوت ۲۰۲۶، ساعت ۱۵:۰۳

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">

<style> /* فقط روی این باکس اعمال شود */ .online-support-box, .online-support-box *{

   margin:0;
   padding:0;
   box-sizing:border-box;
   font-family:Vazirmatn,Tahoma,sans-serif;

}

.online-support-box{

   position:fixed;
   left:20px;
   bottom:20px;
   z-index:999999;

}

.info-box{

   width:min(340px,calc(100vw - 30px));
   background:#BCAAA4;
   border-radius:14px;
   box-shadow:0 4px 18px rgba(0,0,0,.08);
   padding:14px;
   position:relative;
   overflow:hidden;
   transition:.3s;
   will-change:transform,opacity;

}

.info-box.hide{

   opacity:0;
   transform:translateY(15px);
   pointer-events:none;

}

.close{

   position:absolute;
   top:10px;
   left:10px;
   width:30px;
   height:30px;
   border:0;
   border-radius:50%;
   background:#f3f3f3;
   color:#777;
   cursor:pointer;
   display:flex;
   align-items:center;
   justify-content:center;
   transition:.3s;

}

.close:hover{

   transform:rotate(90deg);
   background:#e7e7e7;

}

.info-header{

   display:flex;
   align-items:center;
   gap:10px;
   margin-bottom:10px;
   padding-left:34px;

}

.avatar{

   width:52px;
   height:52px;
   border-radius:50%;
   background:linear-gradient(135deg,#5C3A21,#8B5E3C);
   color:#fff;
   display:flex;
   align-items:center;
   justify-content:center;
   font-size:24px;
   flex-shrink:0;

}

.info-title{

   font-size:15px;
   font-weight:700;
   color:#4E342E;

}

.info-text{

   font-size:14px;
   color:#222;
   line-height:1.9;

}

.mobile-toggle{

   display:none;
   width:56px;
   height:56px;
   border:0;
   border-radius:50%;
   background:linear-gradient(135deg,#5C3A21,#8B5E3C);
   color:#fff;
   font-size:24px;
   cursor:pointer;
   box-shadow:0 5px 16px rgba(0,0,0,.2);

}

@media(max-width:600px){

.online-support-box{

   left:14px;
   bottom:14px;

}

.info-box{

   display:none;

}

.info-box.mobile-open{

   display:block;
   animation:show .3s;

}

.mobile-toggle{

   display:flex;
   align-items:center;
   justify-content:center;

}

.mobile-toggle.hidden{

   display:none;

}

}

@keyframes show{ from{opacity:0;transform:translateY(15px);} to{opacity:1;transform:translateY(0);} } </style>

<button class="mobile-toggle" id="mobileToggle" aria-label="نمایش اطلاعات"> </button>

<section class="info-box" id="infoBox" role="complementary" aria-label="معرفی کافه">

<button class="close" id="closeBtn" aria-label="بستن"> </button>

کافه پاتوق محمد | قهوه و نوشیدنی‌های گرم

کافه پاتوق محمد با ارائه انواع قهوه، نوشیدنی‌های گرم و سرد و فضایی دنج، محیطی مناسب برای دورهمی و لحظاتی آرام و دلنشین فراهم کرده است.

</section>

<script> const box=document.getElementById("infoBox"), btn=document.getElementById("mobileToggle"), close=document.getElementById("closeBtn");

const expire=86400000;

if(localStorage.getItem("coffeeBox")){ const t=Date.now()-Number(localStorage.getItem("coffeeBox")); if(t<expire){ box.style.display="none"; btn.style.display="none"; } }

btn.onclick=()=>{ box.classList.add("mobile-open"); btn.classList.add("hidden"); };

close.onclick=()=>{ localStorage.setItem("coffeeBox",Date.now());

if(innerWidth<=600){ box.classList.remove("mobile-open"); btn.classList.remove("hidden"); }else{ box.classList.add("hide"); setTimeout(()=>box.style.display="none",300); } }; </script>