var height_closed = 24; var height_open = 75; var height_current = height_closed; var height_max = 414; function toggleVisFullKurv() { if (height_current == height_closed) { var th = $('#bunnkurv .handlekurv').height(); height_current = th + height_open; if (height_current > height_max) height_current = height_max; $("#vis_handlekurvspan").text("Ukryj koszyk »"); $("#vis_handlekurvspan").css({"background-position" : "bottom right"}); } else { height_current = height_closed; $("#vis_handlekurvspan").text("Koszyk »"); $("#vis_handlekurvspan").css({"background-position" : "top right"}); } $('#bunnkurv').animate({ top: hent_dimensjoner()[1]-height_current+'px' }, 400, 'swing'); } function positionBottomBasket() { var topcss = (hent_dimensjoner()[1] - height_current)+'px'; $('#bunnkurv').css('top', topcss); } $(window).bind('resize', positionBottomBasket); $(function() { positionBottomBasket(); }); function hent_dimensjoner() { var de = document.documentElement; var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; arrayPageSize = [w,h]; return arrayPageSize; } function VisKurv(){ if(height_current == height_closed){ toggleVisFullKurv(); } } function LukkKurv(){ if(height_current > height_closed){ toggleVisFullKurv(); } }