Phonixe,
вариант закрытия по клику вне элемента без jQuery
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.popul{
background-color: #008000;
width: 150px;
height: 150px;
}
</style>
</head>
<body><div class="nopopul"><h1>This is the element!</h1></div>
<div class="popul"><h1>This is the test!</h1></div>
<script type="text/javascript">
var doc = document;
doc.onclick = function(event) {
event = event || window.event;
var target = event.target || event.srcElement;
while (target != doc) {
if (/(^|\s)popul(\s|$)/.test(target.className)) {
return;
}
target = target.parentNode;
}
document.querySelector('.popul').style.backgroundColor = 'red' //close
} </script>
</body>
</html>