let ele = document.getElementById('modal-center2');
const childNodes = ele.childNodes;
console.log(childNodes);
<p id="header_modal"> Спасибо, мы приняли Вашу заявку! </p> <p id="text_modal"> Специалист перезвонит Вам и ответит на вопросы</p>↵ <p> Телефон горячей линии:</p>
var options = {
root: document.querySelector('#my-scrollbar'),
rootMargin: '0px',
threshold: 1.0
};
var callback = function(entries, observer) {
entries.forEach(entry => {
entry.time; // a DOMHightResTimeStamp indicating when the intersection occurred.
entry.rootBounds; // a DOMRectReadOnly for the intersection observer's root.
entry.boundingClientRect; // a DOMRectReadOnly for the intersection observer's target.
entry.intersectionRect; // a DOMRectReadOnly for the visible portion of the intersection observer's target.
entry.intersectionRatio; // the number for the ratio of the intersectionRect to the boundingClientRect.
entry.target; // the Element whose intersection with the intersection root changed.
entry.isIntersecting; // intersecting: true or false
console.log(entry.target);
});
};
var observer = new IntersectionObserver(callback, options);
var target = document.querySelectorAll('.animate')[1];
observer.observe(target);
<?php
include 'components/fileComponent.php';
if (!empty($_FILES['Files'])) {
$fileComponent = new fileComponent($_FILES['Files']); //Инициализируем класс
try {
$fileComponent->checkMime($mime);
$fileComponent->startDownload();
} catch (Exception $e) {
$fileComponent->addError('Произошел RuntimeExeption, атеншон');
} catch (Exception $e) {
die($e->getMessage());
}
$errors = $fileComponent->isError();
if ($errors) {
foreach ($errors as $error) {
echo "<div style='color: red'>Сообщение ошибки: {$error['msg']} [{$error['obj']}]</div>";
}
} else {
echo 'Нет ошибок';
}
}
<?php
include 'components/helpers.php';
require '../checlOnEmptyFiles.php';
class fileComponent
{
public $files;
public $dir;
public $allowMime;
public $normalSize;
public $errors;
public $helper;
public function __construct($files, $abortDownload = false, $folder = 'files')
{
$this->files = $files;
$this->dir = $_SERVER['DOCUMENT_ROOT'] . '/' . $folder . '/';
$this->allowMime = [
'application/vnd.ms-excel', 'image/jpeg', 'image/png'
];
$this->normalSize = 12000;
$this->helper = new Helpers();
}
public function checkMime($mime)
{
if (in_array($mime, $this->allowMime, false)) {
throw new Exception("Тип данного файла не поддерживается:" . $mime);
}
}
public function addError($msg, $obj = null)
{
$this->errors[] = [
'msg' => $msg,
'obj' => $obj
];
}
public function checkSize($size)
{
if (($this->files['size']) === ($this->normalSize)) {
return true;
}
$this->addError('Размер данного файла большой', $this->helper->formatSize($size));
return false;
}
public function isError()
{
if (!count($this->errors)) {
return false;
}
return $this->errors;
}
public function startDownload()
{
foreach ($this->files['tmp_name'] as $key => $file) {
if (!$this->checkMime($this->files['type'][$key])) {
continue;
}
if (!$this->checkSize($this->files['size'][$key])) {
continue;
}
move_uploaded_file($this->files['tmp_name'][$key], $this->dir . $this->files['name'][$key]);
}
}
}
<?php
include 'components/fileComponent.php';
if (!empty($_FILES['Files'])) {
$fileComponent = new fileComponent($_FILES['Files']); //Инициализируем класс
try {
$fileComponent->checkMime($mime);
$fileComponent->startDownload();
} catch (Exception $e) {
$fileComponent->addError('Произошел RuntimeExeption, атеншон');
} catch (Exception $e) {
die($e->getMessage());
}
$errors = $fileComponent->isError();
if ($errors) {
foreach ($errors as $error) {
echo "<div style='color: red'>Сообщение ошибки: {$error['msg']} [{$error['obj']}]</div>";
}
} else {
echo 'Нет ошибок';
}
}
<?php
include 'components/helpers.php';
require '../checlOnEmptyFiles.php';
class fileComponent
{
public $files;
public $dir;
public $allowMime;
public $normalSize;
public $errors;
public $helper;
public function __construct($files, $abortDownload = false, $folder = 'files')
{
$this->files = $files;
$this->dir = $_SERVER['DOCUMENT_ROOT'] . '/' . $folder . '/';
$this->allowMime = [
'application/vnd.ms-excel', 'image/jpeg', 'image/png'
];
$this->normalSize = 12000;
$this->helper = new Helpers();
}
public function checkMime($mime)
{
if (in_array($mime, $this->allowMime, false)) {
throw new Exception("Тип данного файла не поддерживается:" . $mime);
}
}
public function addError($msg, $obj = null)
{
$this->errors[] = [
'msg' => $msg,
'obj' => $obj
];
}
public function checkSize($size)
{
if (($this->files['size']) === ($this->normalSize)) {
return true;
}
$this->addError('Размер данного файла большой', $this->helper->formatSize($size));
return false;
}
public function isError()
{
if (!count($this->errors)) {
return false;
}
return $this->errors;
}
public function startDownload()
{
foreach ($this->files['tmp_name'] as $key => $file) {
if (!$this->checkMime($this->files['type'][$key])) {
continue;
}
if (!$this->checkSize($this->files['size'][$key])) {
continue;
}
move_uploaded_file($this->files['tmp_name'][$key], $this->dir . $this->files['name'][$key]);
}
}
}