I think this is what you are looking for. Take out the JQuery hide and change your the basket-preview div to display:none in CSS. This should now work if I understand what it is you want
if($(".basket-preview").css('display') !== 'none')
EDIT: Don't waste your time. This doesn't work for what you want. I just read your post properly.