Skip to content

Instantly share code, notes, and snippets.

View kovtunos's full-sized avatar

Andrey Kovtun kovtunos

View GitHub Profile
@kovtunos
kovtunos / .htaccess
Last active September 29, 2017 14:18 — forked from agragregra/.htaccess
htaccess index.html and www redirect #htaccess
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} www.site.com [NC]
RewriteRule (.*) http://site.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(htm(l)?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(htm(l)?|php)$ http://site\.com/$1 [R=301,L]
@kovtunos
kovtunos / jquery-filter-by-field.js
Last active September 29, 2017 14:24 — forked from agragregra/jquery-filter-by-field.js
jQuery Input Field Filter #jquery #form
$('.city-input').keyup(function() {
filter(this);
});
function filter(element) {
var value = $(element).val().toLowerCase();
$('[data-filter]').each(function() {
var $this = $(this),
lower = $this.data('filter').toLowerCase();
if (lower.indexOf(value) > -1) {
@kovtunos
kovtunos / underline_title.css
Created October 5, 2016 07:06
Underline element with #css
h1 {
position: relative;
}
h1:after {
content: '';
display: block;
background: black;
height: 1px;
max-width: 50px;
HTML:
<div class="wrapper">
<div class="tabs">
<span class="tab">Вкладка 1</span>
<span class="tab">Вкладка 2</span>
<span class="tab">Вкладка 3</span>
</div>
<div class="tab_content">
<div class="tab_item">Содержимое 1</div>
<div class="tab_item">Содержимое 2</div>
@kovtunos
kovtunos / list.pug
Created September 7, 2016 06:04
Each item in list #pug
each item in list
li item
@kovtunos
kovtunos / mobile_menu.scss
Last active November 27, 2016 21:36
Mobile menu button with animation #sass #jquery
// SCSS
$menu-bars-color: #000;
%span-menu {
backface-visibility: hidden;
background-color: $menu-bars-color;
border-radius: 2px;
height: 4px;
transition: all .3s;
@kovtunos
kovtunos / _sticky_header.js
Last active November 10, 2016 23:14
Simple sticky header #jquery
// CSS
.sticky {
position: fixed;
left: 0;
top: 0;
z-index: 1000;
width: 100%;
}
// JS
@kovtunos
kovtunos / _simple_slideshow.js
Created August 15, 2016 17:36
Simple slideshow #jquery
$(window).load(function() {
// Simple slideshow
var i = 0;
var images = [
'../img/slideshow-2.jpg',
'../img/slideshow-3.jpg',
'../img/slideshow-4.jpg',
'../img/slideshow-5.jpg',
'../img/slideshow-6.jpg',
'../img/slideshow-7.jpg',
@kovtunos
kovtunos / page-preloader.html
Last active September 29, 2017 14:26
Page preloader #jquery #html #css
<!-- html inline -->
<style>
body {
overflow: hidden;
}
#preloader {
background-color: #fff;
bottom: 0;
left: 0;
@kovtunos
kovtunos / scroll-to-id.js
Last active September 29, 2017 13:58
Smooth scroll to section id #jquery
$('.scroll').on('click', 'a', function(event) {
event.preventDefault();
let id = $(this).attr('href');
let top = $(id).offset().top;
$('body, html').animate({
scrollTop: top
}, 500);
});