Top Bar – Valentine’s Day – Never Show Again

<div class="ifso-pt-2">
  <div class="ifso-pt-2-container-text">
    <stong class="ifso-pt-2-title">Valentine's Day Sale!</stong>
    <p class="ifso-pt-2-text">48 hours only</p>
  </div>

  <div class="ifso-pt-2-container-buttons">
    <a href="#" target="_blank" class="ifso-pt-2-btn-1">LEARN MORE</a>
    <button class="ifso-pt-2-btn-2" onclick="onDisplayModal()">CLOSE</button>
    <div class="ifso-pt-2-modal ifso-pt-shadow">
      <div class="ifso-pt-2-modal-content">
        <button class="ifso-pt-2-btn-3" onclick="onClose()">CLOSE</button>
        <button class="ifso-pt-2-btn-4" onclick="onNeverShow()">NEVER SHOW AGAIN</button>
      </div>
    </div>
  </div>
</div>

<script>
  onReady()
  function onReady() {
    if ( localStorage.getItem('ifso-pt-2') ) {
      document.querySelector('.ifso-pt-2').style.display = 'none'
    } else {
      document.querySelector('.ifso-pt-2-modal').style.display = 'none'
    }
  }
  function onNeverShow() {
    localStorage.setItem('ifso-pt-2', true)
    onClose()
  }
  function onClose() {
    document.querySelector('.ifso-pt-2').style.display = 'none'
    document.querySelector('.ifso-pt-2-modal').removeEventListener('click', stopProp);
    document.removeEventListener('click', outListener);
  }
  function onDisplayModal() {
    var modal = document.querySelector('.ifso-pt-2-modal')
    if ( modal.style.display !== 'none' ) { return onClose() }
    modal.style.display = 'block'
    modal.addEventListener('click', stopProp)
    setTimeout(() => { document.addEventListener('click', outListener) }, 1); 
  }
  function outListener(event) {
    document.querySelector('.ifso-pt-2-modal').style.display = 'none'
    document.removeEventListener('click', outListener);
  }
  function stopProp(e) { e.stopPropagation() }
</script>

<style>
  .ifso-pt-2 {
    background-color: #e02632;
    text-align: center;
    padding: 20px 5px;
  }

  .ifso-pt-2 * {
    margin: 0;
    font-size: 26px;
    font-family: sans-serif;
    color: white;
  }

  .ifso-pt-2-container-buttons {
    margin-top: 5px;
    position: relative;
    display: inline-block;
  }
  .ifso-pt-2-container-text {
    display: inline-block;
  }

  .ifso-pt-2-title {
    margin-right: 10px;
    display: inline-block;
  }
  .ifso-pt-2-text {
    margin-right: 20px;
    display: inline-block;
  }

  .ifso-pt-2 a,
  .ifso-pt-2 button {
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 8px 25px 6px 25px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
  }
  .ifso-pt-2-btn-1 {
    background-color: #c10713;
    text-decoration: none;
  }
  .ifso-pt-2-btn-2 {
    background-color: #e2888d;
  }
  .ifso-pt-2-btn-3 {
    background-color: #091458;
    width: 100%;
    margin-bottom: 5px;
  }
  .ifso-pt-2-btn-4 {
    background-color: #abafc6;
    white-space:nowrap;
  }
  
  .ifso-pt-2-modal {
    display: none;
    position: absolute;
    top: 40px;
    right: 0px;
    z-index: 100;
  }
  .ifso-pt-2-modal-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: white;
    padding: 10px;
  }

  @media (max-width: 400px) {
    .ifso-pt-2 {
      padding: 15px 0px;
    }
    .ifso-pt-2 *{
      font-size: 14px;
    }
    .ifso-pt-2 a,
    .ifso-pt-2 button {
      padding: 8px 20px 6px 20px;
      font-size: 10px;
    }
    .ifso-pt-2-btn-2 {
      padding: 8px 20px 6px 20px;
    }
    .ifso-pt-2-modal {
      top: 30px
    }
  }

  .ifso-pt-shadow {
    box-shadow:
      0 1px 1px hsl(0deg 0% 0% / 0.075),
      0 2px 2px hsl(0deg 0% 0% / 0.075),
      0 4px 4px hsl(0deg 0% 0% / 0.075),
      0 8px 8px hsl(0deg 0% 0% / 0.075),
      0 16px 16px hsl(0deg 0% 0% / 0.075)
    ;
  }
</style>
Use it on your site
Valentine's Day Sale!

48 hours only

LEARN MORE
PREVIEW EXPORT TRIGGER

Categories

Content Type, Desktop, Top-Bars