I have the following code which is used to slidein/out a div (shopping basket) on a page. However, the code will only fire once (open once, close once). Does the toggle need to be reset in some way?
$(document).ready(function(){
var miniBasketHeight = -$('#minibasket div.outer').height();
$('#minibasket a.opener').toggle(
function(e) {
console.log("open");
e.preventDefault();
$(this).parent().find('div.outer').animate({top: 0, opacity: 1 }, 700 );
},
function(e) {
console.log(miniBasketHeight);
e.preventDefault();
$(this).parent().find('div.outer').animate({top: miniBasketHeight, opacity: 0 }, 700 );
}
);
});