$('.floor,.floorcase').click(function() {
$(this).addClass('fade');
});
$(document).mouseup(function (e) {
var container = $('.floor');
if (container.has(e.target).length === 0){
container.removeClass('fade');
}
});
$('.floor').click(function() {
$('.floor, .floorcase').each(function() {
$(this).addClass('fade');
});
});
$(document).mouseup(function(e) {
const floor = $('.floor');
const floorcase = $('.floorcase');
if (floor.has(e.target).length === 0 && floorcase.has(e.target).length === 0) {
floor.removeClass('fade');
floorcase.removeClass('fade');
}
});