Skip to content

Instantly share code, notes, and snippets.

View yaroslavKas's full-sized avatar

Zaichenko Yaroslav yaroslavKas

View GitHub Profile
@yaroslavKas
yaroslavKas / get_name_browser.js
Created April 20, 2016 09:51
Определение браузера
function get_name_browser(){
// получаем данные userAgent
var ua = navigator.userAgent;
// с помощью регулярок проверяем наличие текста,
// соответствующие тому или иному браузеру
if (ua.search(/Chrome/) > 0) return 'Google Chrome';
if (ua.search(/Firefox/) > 0) return 'Firefox';
if (ua.search(/Opera/) > 0) return 'Opera';
if (ua.search(/Safari/) > 0) return 'Safari';
if (ua.search(/MSIE/) > 0) return 'Internet Explorer';
@yaroslavKas
yaroslavKas / Footer_bottom.js
Created May 18, 2016 13:03
Footer постоянно внизу
@yaroslavKas
yaroslavKas / vertical_navigation.css
Last active June 1, 2016 09:17
Кнопки вверх/низ
.wrap-bottom {
position: fixed;
right: 15px;
bottom: 25px;
}
#ToTop,
#OnBottom {
width: 36px;
}
.go-up {
@yaroslavKas
yaroslavKas / validation-form.css
Created May 18, 2016 13:59
Валидация формы
.error-phone.error p{
font-size: 11px;
color: #C32929;
line-height: 11px;
margin-bottom: 5px;
margin-top: 5px;
}
.error-box.error p{
font-size: 11px;
color: #C32929;
@yaroslavKas
yaroslavKas / mail.html
Created May 19, 2016 08:19
Отправка формы
<form id="form2" method="post" class="headerform">
<div class="form-group">
<label>
<input type="text" class="form-control phone" name="phone" id="one_click" placeholder="+7 (___) ___-__-__" >
<input type="hidden" class="name" name="one_click" value="бляя">
</label>
</div>
<button id="submitForm" class="submit" type="submit">Заказать</button>
</form>
//надо вставить <input type="hidden" class="name" name="one_click" value="бляя">
@yaroslavKas
yaroslavKas / random.js
Created May 19, 2016 08:23
Перемешать массив
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
@yaroslavKas
yaroslavKas / menu_item_me_awake_when_you_scroll.js
Created May 19, 2016 13:40
МЕНЯЕМ АКТИВНЫЙ ПУНКТ МЕНЮ ПРИ ПРОКРУТКЕ СТРАНИЦЫ
var menu_selector = ".top-menu"; // Переменная должна содержать название класса или идентификатора, обертки нашего меню.
var menu = jQuery('#header').outerHeight();
jQuery("#mainnav li:first-child a").addClass("current");
function onScroll(){
var scroll_top = jQuery(document).scrollTop();
jQuery(menu_selector + " a").each(function(){
var hash = jQuery(this).attr("href");
var target = jQuery(hash);
@yaroslavKas
yaroslavKas / blur.css
Created May 26, 2016 06:53
Форма в блюре
#form3{
top: 0;
padding: 25px 35px;
}
label {
width: 100%;
}
label input{
width: 100%;
height: 45px;
@yaroslavKas
yaroslavKas / index.html
Created September 19, 2016 09:32
Стилизация input "file"
<div class="file_upload">
<button type="button">Выбрать</button>
<div>Файл не выбран</div>
<input type="file">
</div>
@yaroslavKas
yaroslavKas / function_scroll.js
Created October 4, 2016 10:36
Фиксированный блок при скролле
document.addEventListener("DOMContentLoaded", function() {
function scrollWidget(){
var widget = document.getElementById('villa-calendar-wrapper'),
headerHeight = document.getElementById('header-outer').offsetHeight,
widgetPositionParams = widget.getBoundingClientRect(),
scrollHeight = window.pageYOffset || document.documentElement.scrollTop;
if(widgetPositionParams.top < scrollHeight){
widget.style.top = headerHeight + 20 + 'px';