Hi Friends need your help I trying to develop UI for cart. I need to display cart when user click on buy button cart will show for two second then hide. Now the thing is if user mouseover on the open cart its will remain open once user mouseout from the cart for basic demo you can go to this link http://jsfiddle.net/uVdb3/5/ or you can see my code below
html
<table width="100%">
<tr>
<td width="51%" align="left" valign="bottom"><a href="#" class="buyBtn">Buy Now</a></td>
<td width="49%" align="left" valign="top"></td>
</tr>
</table>
<p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p>
<div class="cart">
<div class="number">0</div>
<div class="cartView">
<table width="100%" class="itmCart">
<td width="16%" class="item"><img src="images/cartPrdView.png" width="55" height="73" alt=" "></td>
<td width="71%">Anniversasdfry Card Pink Rose X 1: Rs 149/-</td>
<td width="13%" align="center"><a href="#" class="delRow"><img src="images/cross-script.png" width="16" height="16" alt=" "></a></td>
</tr>
</table>
<table width="100%" class="price">
<tr>
<td width="50%">Item Cost</td>
<td align="right">Rs 649.00 /-</td>
</tr>
<tr>
<td>Shipping Cost</td>
<td align="right">Rs 30.00 /-</td>
</tr>
<tr>
<td><span>Amount Payable</span></td>
<td align="right"><span>Rs 679.00 /-</span></td>
</tr>
</table>
<table width="100%" class="btnCont">
<tr>
<td align="center"><a href="#" id="CrtBtn"> Show cart</a></td>
<td align="center"><a href="#" id="CrtBtn">Pay now</a></td>
</tr>
</table>
</div>
</div>
css
.oneItem{background:red; color:#fff; border-radius:110px; padding:0px 14px; float:left; font-weight:bold; font-size:14px; position:absolute; top:0; left:0;}
.cart{position:absolute;}
.cart .cartView{position: absolute; background: red; width: 350px; padding: 8px; left: -5px;
top: 30px; z-index:999; behavior: url(css/PIE.htc); -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius:5px; display:none;
}
script
function opencart(){
//alert('hi')
$('.cart').children('.cartView').slideDown(200);
setTimeout(function(){
$('.cart').children('.cartView').slideUp(200);
},2000)
}
$('.buyBtn').click(function () {
$(this).append("<div class='oneItem'>1</div>")
var buyPos = $(this).position();
var buyPosL = buyPos.left;
var buyPosT = buyPos.top;
var CartPos = $('.cart .number').offset();
var CartPosL = CartPos.left;
var CartPosT = CartPos.top;
$('.oneItem').css({
left: buyPosL + 'px',
top: buyPosT + 'px'
})
$('.oneItem').animate({
left: CartPosL + 'px',
top: CartPosT + 'px'
}, 1000, function () {
$(this).remove();
opencart();
})
})
In this code my cart opens in red color code working perfact but cart close aftre 2 seconds. How to stop cart to get close when user mouse over the cart and when user mouse out from the cart it get close
Please help me guys thanks in advance.. :)