const descriptionTextFunctions = (function () {
const getElements = () => {
const dtTable = document.querySelector('.description_text');
const dtMax = document.querySelector('.description_text-maximize-icon');
const dtMin = document.querySelector('.description_text-minimize-icon');
return [dtTable, dtMax, dtMin];
}
const expand = () => {
const [dtTable, dtMax, dtMin] = getElements();
dtMax.addEventListener('click', function () {
dtTable.classList.remove('description_collapse');
dtMax.classList.add('icon-hidden');
dtMin.classList.remove('icon-hidden');
})
}
const collapse = () => {
const [dtTable, dtMax, dtMin] = getElements();
...
.block-criteria label {
font-size: 14px;
color: #c4c4c4;
position: absolute;
left: 0;
top: 0;
z-index: 1;
cursor: pointer;
}
.block-criteria__form:focus + label {
font-size: 12px;
bottom: initial;
top: -20px;
transition: all 0.3s ease-out;
}
subnav.addEventListener('scroll', function(evt){
if(Math.ceil(this.scrollTop + this.clientHeight) >= this.scrollHeight){ // this в данном случае будет элемент subnav. на всякий случай округляем немного вверх.
// Доскролили вниз, можно добавить класс чтобы переключить состояние указателя
} else {
// недоскролили вниз // можно снять класс чтобы переключить обратно
}
})
<?php
$arrX = array(2, 4, 6, 8, 10, 12, 14, 16, 18, 20);
$arrY = array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19);
$iter = 100000;
$start = microtime(true);
$number_p = 3.14;
$distance = 40 / 5;
$total = 0;
$cntX = count($arrX);
$cntY = count($arrY);
$var0 = $number_p * $distance;
for ($a = 0; $a < $iter; $a++) {
$varA = $number_p + $a;
foreach ($arrX as $i => $x) {
$varB = $x * $varA;
foreach ($arrY as $j => $y) {
$value = $varB * ($y + $var0);
$total += $value;
switch ($i) {
case 3:
$total += 100;
break;
case 6:
$total += 500;
break;
case 9:
$total += 1000;
break;
}
if ($value % 2 == 0) {
$total = $total + 1;
} else {
$total = $total + 2;
}
}
}
}
echo "Total: $total";
$time = microtime(true) - $start;
echo "<br>Script time is $time";
for ($i = 0; $i < count($arrX); $i++) {
for ($j = 0; $j < count($arrY); $j++) {
$tmpValue = $arrX[$i] * ($arrY[$j] + ($number_p * $distance));
for ($a = 0; $a < $iter; $a++) {
$value = $tmpValue * ($number_p + $a);
$arrXcount = count($arrX);
$arrYcount = count($arrY);
for ($a = 0; $a < $iter; $a++) {
for ($i = 0; $i < $arrXcount; $i++) {
for ($j = 0; $j < $arrYcount; $j++) {
...
}
}
}
if ($value % 2 == 0) {
$total = $total + 1;
}
if ($value % 2 != 0) {
$total = $total + 2;
}
if ($value % 2 == 0) {
$total = $total + 1;
} else {
$total = $total + 2;
}
echo "Total: $total";
echo "<br>Script time is $time";
echo 'Total: ' . $total;
echo '<br>Script time is ' . $time;