Merge pull request #334 from budziq/hide_popup

Hide theme selection popup after interaction
This commit is contained in:
Mathieu David 2017-06-23 14:15:54 +02:00 committed by GitHub
commit 03193e0bd7
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 {