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
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 / 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 / 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 / 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 / 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") {