diff --git a/~dev_rating/media/js/profile.js b/~dev_rating/media/js/profile.js index 01a94160c63b7873a50f8e92e41027078c82ead3..b33089e2adfbea38599489e8172186f886b032c8 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; } });