Skip to content

Instantly share code, notes, and snippets.

View webag's full-sized avatar

Андрей webag

  • Pen&Brain
  • Kazan, Russian Federation
View GitHub Profile
@webag
webag / main.js
Last active December 22, 2023 08:34
native js slideToggle
btn.addEventListener('click', () => {
btn.classList.toggle('opened');
slideToggle(popupBlock, 300, function() {
console.log('callback ended animation');
});
})
function slideToggle(container, speed = 300, callback) {
let currentState;
if (window.getComputedStyle(container).display == "none") {
@webag
webag / index.html
Created December 6, 2023 12:14
SVG goo intersection blur. СВГ скругление пересечений путей.
<div class="box">
<div class="test"></div>
<div class="test-2"></div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="3" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9" result="goo" />
@webag
webag / amo.php
Last active October 23, 2023 23:22
Amocrm new version integration
<?
$subdomain = "XXX";
$client_id = "XXX"; // id нашей интеграции
$client_secret = "XXX"; // секретный ключ нашей интеграции
$redirect_uri = "https://XXX.ru/"; // домен сайта нашей интеграции
$amoTokenFile = $_SERVER['DOCUMENT_ROOT'] . "/ajax/amotoken.txt"; // Путь для файла с токенами - любой удобный
$responsible_user_id = 9380670;
$resultAmoIntegration = [];
@webag
webag / main.js
Created May 4, 2021 06:28
intersection anim entries
/* Anim Observer BEGIN */
document.addEventListener("DOMContentLoaded", function(event) {
const elements = document.querySelectorAll('.anim');
const options = {
rootMargin: '0px 0px',
threshold: 1
}
const callback = (entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
@webag
webag / main.js
Created October 30, 2020 08:27
Intersection ovserver video play pause
const videos = document.querySelectorAll("video");
const config = {
rootMargin: '0px -100px',
threshold: 0
}
const callback = (entries) => {
entries.forEach((entry) => {
if (!entry.isIntersecting) {
entry.target.pause();
console.log('Exit video');
@webag
webag / result_modifier.php
Created August 20, 2020 13:03
Следующий и предыдущий элемент битрикс, bitrix next prev
// Получаем следующий и предыдущий элемент
$query = CIBlockElement::GetList(
array('SORT' => 'ASC'),
array('IBLOCK_ID' => $arResult['IBLOCK_ID'],'ACTIVE' => 'Y'),
false,
array('nPageSize' => 1, 'nElementID' => $arResult['ID']),
array('ID', 'DETAIL_PAGE_URL','DETAIL_PICTURE','NAME')
);
while ($elem = $query->GetNextElement()) {
$arElements[] = $elem->GetFields();
@webag
webag / main.js
Created July 24, 2020 13:10
Прогресс слайдера, slider progress, stories, сторис
$(function($){
const duration = 5;
const interval = 10;
const stepsBars = $('.intro-step');
let isPaused = false;
let percentTime, step, tick, scaleWidth;
let currentIndex = 0;
let introSlider = $('.intro-slider').flickity({
cellAlign: 'left',
@webag
webag / index.html
Created April 28, 2020 06:49
Fancybox yandex maps
<!-- CWCBfK05 - ID нужного места-->
<a href="https://yandex.by/map-widget/v1/-/CWCBfK05" class="fancy-map">
ссылка
</a>
@webag
webag / main.js
Created October 14, 2019 06:53
Загрузка карты по waypoint. Map waypoint load
function initMap(){
let myMap = new ymaps.Map("map", {
center: [55.76, 37.64],
zoom: 7
});
}
$(function($){
function addScript(src) {
let s = document.createElement('script');
@webag
webag / template.php
Created June 21, 2019 07:53
Получить список элементов инфоблока D7 bitrix битрикс
<?
$dbItems = \Bitrix\Iblock\ElementTable::getList(array(
'select' => array('ID', 'NAME', 'IBLOCK_ID'),
'filter' => array('IBLOCK_ID' => $arParams['IBLOCK_ID'])
));
while ($arItem = $dbItems->fetch()){
$dbProperty = \CIBlockElement::getProperty(
$arItem['IBLOCK_ID'],
$arItem['ID']
);