Tue Sep 24 2019
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
<script defer>
    desktopAnchor = '.add-to-cart'

    var $cartwrap = $('#cart-iframe-wrap')
    var $cartOverlay = $('#cart-overlay')
    var $iframe = $('#cart-iframe')

    $(desktopAnchor).unbind()
    $(desktopAnchor).off()

    $(desktopAnchor).click(function(e) {  
      console.log('clicked-!---')
      e.preventDefault()
      $cartOverlay.fadeIn()
      $cartwrap.fadeIn().css({display: 'flex'})
      
      console.log($cartwrap.length)
      
      var href = e.target.href      
      $iframe.attr('src', href)
      console.log(href)
    })

    $('.close-cart').click(function(e) {
      e.preventDefault()
      closeCartOverlay()
    })

    $cartOverlay.click(function(e) {
      closeCartOverlay()
    })

    function closeCartOverlay () {
      $cartwrap.fadeOut()
      $cartOverlay.fadeOut()
      $iframe.attr('src', '')
    }
  </script>

<div id="cart-overlay"></div>
    <div id="cart-iframe-wrap">
      <div class="cart-header">
        <div class="items">
          1 item in your cart
        </div>
        <div class="cart-secure">
          SECURE<br>CHECKOUT
        </div>
        <a href="" class="close-cart">&times;</a>
      </div>
        <div class="loading-div">
            <div class="lds-dual-ring"></div>
            <div style="font-size:90%">Loading cart</div>
        </div>
      <iframe src="" frameborder="0" id='cart-iframe'></iframe>
    </div>        
    

    
    <style>
      #cart-overlay {
        position: fixed;
        height: 100%;
        width: 100%;
        left: 0;
        top: 0;
        background: rgba(0,0,0, 0.7);
        display: none;
      }
      #cart-iframe-wrap {        
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        z-index: 5;
        background: #fff;
        display: flex;
        flex-direction:column;
        align-items: center;
        box-shadow: -2px -1px 9px 0px  rgba(0,0,0,0.7);
        font-family: effra;
        width: 480px;
        display: none;
        
      }

      .loading-div {
        position: absolute;
        top: 100px;
      }

      .cart-header {
        background: #262626;
        color: #fff;
        width: 100%;
        padding: 15px;
        box-sizing: border-box;
        font-weight: bold;
        display: flex;
        position: relative;
        justify-content: space-between;
      }

      .items {
        line-height: 30px;
      }

      .close-cart {
        text-decoration: none;
        color: #fff;
        top: -5px;
        right: 10px;
        position: absolute;
        font-size: 25px;
      }
      .cart-secure {
        padding-right: 40px;
        line-height: 15px;
        font-size: 13px
      }
      #cart-iframe {
        z-index: 2;
        width: 100%;
        height: 100%;
      }

    .lds-dual-ring {
      display: inline-block;
      width: 64px;
      height: 94px;
      
    }
    .lds-dual-ring:after {
      content: " ";
      display: block;
      width: 70px;
      height: 70px;
      margin: 1px;
      border-radius: 50%;
      border: 5px solid #f0c23f;
      border-color: #f0c23f transparent #f0c23f transparent;
      animation: lds-dual-ring 1.2s linear infinite;

    }
    @keyframes lds-dual-ring {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(360deg);
      }
    }

    </style>