handleTouchStart =function(e) {
xDown = e.touches[0].clientX;
yDown = e.touches[0].clientY;
};
handleTouchMove = function(e) {
if ( ! xDown || ! yDown ) {
return;
}
var xUp = e.touches[0].clientX;
var yUp = e.touches[0].clientY;
var xDiff = xDown - xUp;
var yDiff = yDown - yUp;
if(Math.abs( xDiff )+Math.abs( yDiff )>150)
if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {
if ( xDiff > 0 )
alert('лево');
else
alert('право');
} else {
if ( yDiff > 0 )
alert('вверх');
else
alert('вниз');
}
xDown = null;
yDown = null;
};
var xDown = null;
var yDown = null;
document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('touchmove', handleTouchMove, false);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://nightout.ru/photoreport/alpen-grotte/after-party-zolotoi-sostav-0?page=0');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Encoding: gzip'));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
echo gzinflate(substr($result,10));
<?php
function strpos_array($haystack, $needles) {
if ( is_array($needles) ) {
foreach ($needles as $str) {
if ( is_array($str) ) {
$pos = strpos_array($haystack, $str);
} else {
$pos = strpos($haystack, $str);
}
if ($pos !== FALSE) {
return $pos;
}
}
} else {
return strpos($haystack, $needles);
}
}
// Test
echo strpos_array('This is a test', array('test', 'drive')); // Output is 10
const chainScripts = src => src.reduce((acc, n) => {
return acc.then(() => new Promise((resolve, reject) => {
const s = document.createElement('script');
s.onload = resolve;
s.onerror = reject;
s.src = n;
document.head.appendChild(s);
}));
}, Promise.resolve());
p.process-block__stage-number.active I
p.process-block__stage-number II
p.process-block__stage-number III
p.process-block__stage-number IV
button.process-block__btn(data-change=-1)
span
b prev
button.process-block__btn(data-change=+1)
span
b next
document.addEventListener('click', function(e) {
const button = e.target.closest('[data-change]');
if (button) {
const blocks = [...document.querySelectorAll('.process-block__stage-number')];
let active = blocks.findIndex(n => n.classList.contains('active'));
blocks[active].classList.remove('active');
active = Math.max(0, Math.min(blocks.length - 1, active + +button.dataset.change));
blocks[active].classList.add('active');
}
});
Правильно ли я понимаю, что компоненты это независимые объекты которые можно использовать на разных страницах (в разных местах страницы) : кнопка, навигация, попап, прочее
pages или view это страницы проекта.
layout это основа для однотипных страниц, админки, главной