Skip to content

Instantly share code, notes, and snippets.

@sharkyak
sharkyak / common.js
Last active November 6, 2015 04:50
Простая проверка телефона на валидность
function testPhone(phoneName) {
var re = /^[\d\(\)\+ -]+$/;
return re.test($(phoneName).val());
}
@sharkyak
sharkyak / common.js
Last active December 16, 2016 15:39
отправка формы ajax email send
$('#Popup-Form').submit(function() {
if (testPhone('#Phone')) {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
$(this).find("input").val('');
$('#Popup-Form').trigger("reset");
document.location.href = 'thankyou.html';
@sharkyak
sharkyak / mail.php
Last active January 26, 2017 10:51
mail.php
<?php
$to = "[email protected]"; // адрес куда отправлять письмо
$subject = "Отправка формы с сайта агентства"; // заголовок письма
$redirect = "http://dev.ak-agency.ru/zhaluzi/thankyou.html"; // адрес страницы, на которую нужно перейти после отправки письма
foreach($_POST as $key => $value)
{ $fields .= $key.": ".$value." \r\n"; }
$message = $subject." \r\n".$fields;
$headers = "Content-type: text/plain; charset=utf-8 \r\n";
mail($to, $subject, $message, $headers);
@sharkyak
sharkyak / common.js
Last active November 6, 2015 04:42
preloader
$(window).load(function() {
$(".loader_inner").fadeOut();
$(".loader").delay(400).fadeOut("slow");
});
/* плавное изменение прозрачности placeholder-а при фокусе */
.input1::-webkit-input-placeholder {opacity: 1; transition: opacity 0.3s ease;}
.input1::-moz-placeholder {opacity: 1; transition: opacity 0.3s ease;}
.input1:-moz-placeholder {opacity: 1; transition: opacity 0.3s ease;}
.input1:-ms-input-placeholder {opacity: 1; transition: opacity 0.3s ease;}
.input1:focus::-webkit-input-placeholder {opacity: 0; transition: opacity 0.3s ease;}
.input1:focus::-moz-placeholder {opacity: 0; transition: opacity 0.3s ease;}
.input1:focus:-moz-placeholder {opacity: 0; transition: opacity 0.3s ease;}
.input1:focus:-ms-input-placeholder {opacity: 0; transition: opacity 0.3s ease;}
/* сдвиг placeholder-а вправо при фокусе*/
@sharkyak
sharkyak / index.html
Created November 7, 2015 11:26
iOS phone selection
<meta name="format-detection" content="telephone=no">
@sharkyak
sharkyak / goals.js
Last active February 3, 2018 10:48
Цели Google.Analytics и Яндекс.Метрика goals
$(".count_element").on("click", (function() {
// analytics.js
ga("send", "event", "goal", "goal");
// gtm.js
gtag('event', 'read', { 'event_category': 'abr' }); //gtag('event', 'goal', { 'event_category': 'goal' });
yaCounterXXXXXXXX.reachGoal("goal");
return true;
}));
@sharkyak
sharkyak / clean.html
Created November 11, 2015 12:21
Чистый html
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="ru"> <!--<![endif]-->
<!--[if lt IE 9]>
<script src="libs/html5shiv/es5-shim.min.js"></script>
<script src="libs/html5shiv/html5shiv.min.js"></script>
<script src="libs/html5shiv/html5shiv-printshiv.min.js"></script>
<script src="libs/respond/respond.min.js"></script>
@sharkyak
sharkyak / jquery.fancybox.css
Created November 17, 2015 09:40
fancybox2 scroll to up problem
.fancybox-lock body {
/*overflow: hidden !important;*/
}
@sharkyak
sharkyak / functions.php
Last active December 3, 2015 09:13
Wordpress all templates
show_admin_bar(false);
add_theme_support('post-thumbnails');
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'rsd_link' );
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');