<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">×</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>