Skip to content

Instantly share code, notes, and snippets.

View fabriziofeitosa's full-sized avatar
🏠
Working from home

Fabrizio Feitosa fabriziofeitosa

🏠
Working from home
View GitHub Profile
@fabriziofeitosa
fabriziofeitosa / clickForaDaArea.js
Last active September 9, 2020 11:35
(JS) (jQuery) Click fora da área
$(function () {
$("body").on("click", function (e) {
// Defina o alvo | Ex.: ".notificacao,.boxPerfil" | Não faz nada se for o alvo.
if ($(e.target).closest(".notificacao,.boxPerfil").length) return;
// O que deve ser feito caso não seja o alvo?
console.log("Você clicou fora do alvo!");
document.getElementById("optNotif").checked = false;
document.getElementById("optMenu").checked = false;
});
@fabriziofeitosa
fabriziofeitosa / Constant-width-to-height-ratio.css
Last active September 9, 2020 11:40
(CSS) Constant width to height ratio
.constant-width-to-height-ratio {
background: #333;
width: 50%;
}
.constant-width-to-height-ratio::before {
content: '';
padding-top: 30%;
float: left;
}
.constant-width-to-height-ratio::after {