Hide theme selector popup on interaction outside of it

Also set cursor to pointer on theme selector items.
This commit is contained in:
Michal Budzynski 2017-06-23 13:18:06 +02:00
parent 69b3e2b5cb
commit 672d91e6c2
3 changed files with 12 additions and 1 deletions

View file

@ -273,6 +273,7 @@ table thead td {
padding: 2px 10px;
line-height: 25px;
white-space: nowrap;
cursor: pointer;
}
.theme-popup .theme:hover:first-child,
.theme-popup .theme:hover:last-child {

View file

@ -101,11 +101,20 @@ $( document ).ready(function() {
$('.theme').click(function(){
var theme = $(this).attr('id');
set_theme(theme);
});
}
});
// Hide theme selector popup when clicking outside of it
$(document).click(function(event){
var popup = $('.theme-popup');
if(popup.length) {
var target = $(event.target);
if(!target.closest('.theme').length && !target.closest('#theme-toggle').length) {
popup.remove();
}
}
});
function set_theme(theme) {

View file

@ -12,6 +12,7 @@
padding: 2px 10px
line-height: 25px
white-space: nowrap
cursor: pointer
&:hover:first-child,
&:hover:last-child {