Skip to content

Instantly share code, notes, and snippets.

@Jenya476
Jenya476 / Fix header to scroll
Last active February 17, 2017 14:48
Фикcированная шапка при скролле
$("#header").removeClass("default");
$(window).scroll(function(){
if ($(this).scrollTop() > 20) {
$("#header").addClass("default").fadeIn('fast');
} else {
$("#header").removeClass("default").fadeIn('fast');
};
});
@Jenya476
Jenya476 / Smoothscrol
Created February 17, 2017 14:51
Плавный сролл до блока
$('a[data-target^="anchor"]').bind('click.smoothscroll', function(){
var target = $(this).attr('href'),
bl_top = $(target).offset().top - 70;
$('body, html').animate({scrollTop: bl_top}, 700);
return false;
});
@Jenya476
Jenya476 / Beautiful underline when hovering
Created February 17, 2017 15:09
Красивое подчеркивание при навидении
&:after
content: ""
display: block
height: 1px
background-color: #fff
position: absolute
right: 50%
left: 50%
bottom: 0
transition: all 300ms
@Jenya476
Jenya476 / mnu_btn
Last active February 20, 2017 08:00
Кнопка меню с анимацией при нажатии
//html
<body>
<div class="wrapper">
<div class="top bar"></div>
<div class="middle bar"></div>
<div class="bottom bar"></div>
</div>
</body>
//css
@Jenya476
Jenya476 / adaptive menu
Created February 23, 2017 08:36
Скрипт адаптивного меню
// открытие и скрытие меню по клику
//объявляем переменные (кнопка меню и само меню)
var mnuBtn = $('.mnu_btn'),
mnu_toogle = $('.mnu_wrap');
//действие по клику
mnuBtn.click(function() {
$(this).toggleClass('active');
mnu_toogle.toggle(500);
// Place your settings in the file "User/Preferences.sublime-settings", which
// overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overridden in the platform
@Jenya476
Jenya476 / custom radio-buttons
Last active December 13, 2017 12:18
Стилизация radio-buttons
input[type="radio"]{
display:inline-block;
position:relative;
top: 3px;
height: 16px;
width: 16px;
margin-left: 30px;
margin-right: 15px;
background-color: #ffffff;
border: 2px solid #00a191;
floatValidator(event) {
const value = event.target.value;
const key = event.key;
const newValue = value + key;
const patternZeroInBeginning = /^0+(\d)/;
const patternNumber = /\d/;
if ((key !== '.' && !patternNumber.test(key)) || value && key === '.' && value.indexOf('.') > 0) {
event.preventDefault();