From 2575a09de2ff870d41e58e34d496f8672fca817e Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Wed, 26 Nov 2014 19:30:46 +0300 Subject: [PATCH] profiler click hiding --- ~dev_rating/media/js/profile.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/~dev_rating/media/js/profile.js b/~dev_rating/media/js/profile.js index 01a94160c..b33089e2a 100644 --- a/~dev_rating/media/js/profile.js +++ b/~dev_rating/media/js/profile.js @@ -1,16 +1,33 @@ $(function() { + var jProfiler = $('#profileInfo').first(); var isOpened = false; + var flag = false; // Показ профиля при нажатии + + $(document).click(function() { + if (flag === true) { + flag = false; + } else if (isOpened === true) { + jProfiler.css('display', 'none'); + isOpened = false; + } + }); + + $(".profile_wrapper").click(function() { + flag = true; + }); + $('#top_username').click(function() { + flag = true; if(isOpened) { - $('#profileInfo').css('display', 'none'); + jProfiler.css('display', 'none'); isOpened = false; } else { - $('#profileInfo').css('display', 'block'); + jProfiler.css('display', 'block'); isOpened = true; } }); -- GitLab