Skip to content

Instantly share code, notes, and snippets.

@IgorGavrilenko
IgorGavrilenko / блок на всех стр, кроме главной
Created December 20, 2016 13:26
блок на всех стр, кроме главной
<?if ($_SERVER['REQUEST_URI'] != '/' && $_SERVER['REQUEST_URI'] != '/index.html' && $_SERVER['REQUEST_URI'] != '/index.php'){?>
text
<?}?>
@IgorGavrilenko
IgorGavrilenko / замена подстроки
Created December 27, 2016 14:35
замена подстроки
$('.class').each(function() {
$(this).html(function () {
var res = $(this).html().replace(new RegExp(/ text /ig), 'text');
return res;
});
});
@IgorGavrilenko
IgorGavrilenko / jQuery TextChange Plugin
Created December 28, 2016 12:03
jQuery TextChange Plugin
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function(a){a.event.special.textchange={setup:function(){a(this).data("lastValue",this.contentEditable==="true"?a(this).html():a(this).val());a(this).bind("keyup.textchange",a.event.special.textchange.handler);a(this).bind("cut.textchange paste.textchange input.textchange",a.event.special.textchange.delayedHandler)},teardown:function(){a(this).unbind(".textchange")},handler:function(){a.event.special.textchange.triggerIfChanged(a(this))},delayedHandler:function(){var c=a(this);setTimeout(function(){a.event.special.textchange.triggerIfChanged(c)},
25)},triggerIfChanged:function(a){var b=a[0].contentEditable==="true"?a.html():a.val();b!==a.data("lastValue")&&(a.trigger("textchange",[a.data("lastValue")]),a.data("lastValue",b))}};a.event.special.hastext={setup:function(){a(this).bind("textchange",a.event.special.h
setTimeout(function(){
},250);
@IgorGavrilenko
IgorGavrilenko / scroll_to_element
Last active August 24, 2021 12:14
scroll_to_element
$(function() {
// scroll_to_element
var scrollToElement = function (toggle, anchor) {
$(toggle).click(function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: $(anchor).offset().top
}, 1000);
});
// sticky
var menu_position = $('.nav-page').offset().top;
$(window).scroll(function(){
if( $(this).scrollTop() > menu_position ){
$('.nav-page').addClass('fixed');
}
else {
$('.nav-page').removeClass('fixed');
}
.video-container {
position: relative;
height: 0;
padding-bottom: 56.25%;
}
.video-container > * {
position: absolute;
top: 0;
left: 0;
.styled-checkbox {
position: absolute;
opacity: 0;
& + label {
position: relative;
cursor: pointer;
padding: 0;
font-size: 18px;
color: #fff;
@IgorGavrilenko
IgorGavrilenko / spoiler
Last active December 13, 2022 10:51
spoiler
(function() {
function tab(trigger, item) {
// $(item).hide()
$(trigger).click(function(event) {
event.stopPropagation();
$(item).not($(this).next()).slideUp(250);
$(this).next().slideToggle(250);
return false;
})
$('html').click(function(event) {
@IgorGavrilenko
IgorGavrilenko / popap
Last active October 10, 2019 13:34
popap
<div class="popup form-popap"><!--js-->
<div class="table_popup">
<div class="cell_popup">
<div class="box_popup"><!--js-->
<span class="close_popup">✕</span><!--js-->
<div class="content_popup">
<form class="form" action="#" method="POST" accept-charset="utf-8">
<h2 class="form__title">Обратный звонок</h2>
<div class="form__group">
<label class="form-label" for="form-name"></label>