JavaScript
- 2 ответа
- 0 вопросов
1
Вклад в тег
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="page">
<div class="content-container">
<div class="header">
<img src="https://uprostim.com/wp-content/uploads/2021/05/image001-7.jpg" alt="">
<div class="head-pos">
<h2 style="text-align: center;">Заголовок<p style="font-size: 12px">Текст</p></h2>
</div>
</div>
</div>
</div>
</body>
<style>
@import url(https://fonts.googleapis.com/css?family=Montserrat:100,200,300,regular,500,600,700,800,900,100italic,200italic,300italic,italic,500italic,600italic,700italic,800italic,900italic);
*{
margin:0;
padding:0;
}
html{
font-family: 'Montserrat';
}
.head-pos{
width: 100%;
height: 100%;
backdrop-filter: brightness(40%);
}
.header{
color:white;
width: 100%;
/*
height: 450px;
background-size: 100%;
background-repeat: no-repeat;
background-image: url(photo.jpg);
*/
}
.page{
width: 100%;
display: flex;
justify-content: center;
background-color: rgb(250, 250, 250);
}
.content-container{
width: 800px;
height: auto;
margin: 0px 10px 0px 10px;
background-color: white;
}
/***********/
img {
max-width: 100%;
display: block;
}
.header {
position: relative;
}
.head-pos {
position: absolute;
left: 0;
top: 0;
}
</style>
</html>
$(document).on('click', function(event) {
const isPopupClicked = Boolean(event.target.closest('.music-content'));
if (!isPopupClicked) {
$('.music-content').removeClass('open');
}
});
<div class="music-content"></div>
<button class="music-btn">Open</button>
.music-content {
width: 400px;
height: 400px;
visibility: hidden;
position: absolute;
left: 50%;
top: 0;
background-color: tomato;
transform: translate(-50%, -100%);
opacity: 0;
transition: transform ease .5s, opacity ease .2s, visibility ease .2s;
}
.open {
transform: translate(-50%, 20%);
opacity: 1;
visibility: visible;
}
$(document).on('click', function(event) {
const isPopupClicked = Boolean(event.target.closest('.music-content'));
if (!isPopupClicked) {
$('.music-content').removeClass('open');
}
});
$('.music-btn').on('click', function(event) {
event.stopPropagation();
$('.music-content').addClass('open');
});
// Убрать ненужные теги у Contact Form
add_filter('wpcf7_form_elements', function($content) {
// Убрать обёртку в виде <span>
$content = preg_replace('/<(span).*?class="\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^"]+)?\s*"[^\>]*>(.*)<\/\1>/i', '\2', $content);
// Убрать атрибуты size, rows, cols
$content = preg_replace('/(size|rows|cols)="\d+"/i', '', $content);
return $content;
});