$(document).ready(function () { $('.TGC-social.small').css({ zIndex: '9999' }); if ($('.TGC-signin-form').hasClass('logged')) { var top_var = '-90'; $('.TGC-signin-panel').css({ top: -90 }); }else{ var top_var = '-206'; } $('#openpanel').click(function (e) { e.preventDefault(); if ($('.TGC-signin-panel').hasClass('open')) { $('.TGC-signin-panel').animate({ top: top_var }, 500, 'swing').removeClass('open'); // Set a delay of 500ms and then set z-index to .TGC-social.small $('.TGC-social.small') .delay(500) .queue(function () { $(this).css({ zIndex: '9999' }).dequeue(); }) } else { $('.TGC-signin-panel').animate({ top: '0' }, 500, 'swing').addClass('open'); $('.TGC-social.small').css({ zIndex: '1' }); } return false; }); $('html').click(function (e) { var container = $('.TGC-signin-panel'); if (!container.is(e.target) && container.has(e.target).length === 0) { container.animate({ top: top_var }, 500, 'swing').removeClass('open'); // Set a delay of 500ms and then set z-index to .TGC-social.small $('.TGC-social.small') .delay(500) .queue(function () { $(this).css({ zIndex: '9999' }).dequeue(); }) } }); $('#TGC-cart-block').hover( function () { var viewPortWidth = $(window).width(); var containerWidth = $('.container').width(); if ((viewPortWidth - containerWidth) / 2 > 244) { $(this).find('.TGC-cartpopup').addClass('side'); } else { $(this).find('.TGC-cartpopup').removeClass('side'); } $(this).find('.TGC-cartpopup').fadeIn('fast'); }, function () { $(this).find('.TGC-cartpopup').fadeOut('fast'); } ); $('.TGC-shortlist li').hover( function () { $(this).find('.dropdown-small').fadeIn('fast'); }, function () { $(this).find('.dropdown-small').fadeOut('fast'); } ); $(function () { $.scrollUp({ scrollImg: true } ); }); });