Skip to content

Instantly share code, notes, and snippets.

View romanoffs's full-sized avatar
🎯
Focusing

Денис romanoffs

🎯
Focusing
View GitHub Profile
@romanoffs
romanoffs / index.html
Created July 9, 2017 19:49
start_html
<!DOCTYPE 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]-->
<head>
<meta charset="utf-8">
@romanoffs
romanoffs / common.js
Created July 22, 2017 13:28
Цели для Аналитики
//Цели для Яндекс.Метрики и Google Analytics
$(".count_element").on("click", (function() {
ga("send", "event", "goal", "goal");
yaCounterXXXXXXXX.reachGoal("goal");
return true;
}));
@romanoffs
romanoffs / common.js
Created July 22, 2017 13:28
SVG Fallback
//SVG Fallback
if(!Modernizr.svg) {
$("img[src*='svg']").attr("src", function() {
return $(this).attr("src").replace(".svg", ".png");
});
};
@romanoffs
romanoffs / common.js
Last active August 13, 2017 09:22
Аякс отправка форм
//Аякс отправка форм
//Документация: http://api.jquery.com/jquery.ajax/
$("#form").submit(function() {
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
alert("Спасибо за заявку!");
setTimeout(function() {
@romanoffs
romanoffs / common.js
Created July 22, 2017 13:29
Chrome Smooth Scroll
/Chrome Smooth Scroll
try {
$.browserSelector();
if($("html").hasClass("chrome")) {
$.smoothScroll();
}
} catch(err) {
};
@romanoffs
romanoffs / gist:5609a4228ae5109bb0a8d8316d5c953e
Last active June 16, 2018 22:11
disabled access wget user agent (apache2)
RewriteCond %{HTTP_USER_AGENT} wget [NC]
RewriteRule .* - [F]
@romanoffs
romanoffs / scroll.js
Created July 31, 2017 13:34
scroll.js
$('a[href^="#"]').bind('click.smoothscroll',function (e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 500, 'swing', function () {
window.location.hash = target;
@romanoffs
romanoffs / youtube.js
Last active December 12, 2018 16:37
youtube embeded
"use strict";
$(function() {
$(".youtube").each(function() {
$(this).css('background-image', 'url(//i.ytimg.com/vi/' + this.id + '/sddefault.jpg)');
$(this).append($('<div/>', {'class': 'play'}));
$(document).delegate('#'+this.id, 'click', function() {
var iframe_url = "https://www.youtube.com/embed/" + this.id + "?autoplay=1&autohide=1";
if ($(this).data('params')) iframe_url+='&'+$(this).data('params');
@romanoffs
romanoffs / common.js
Created August 10, 2017 16:11
защита от копирования
document.ondragstart = noselect;
document.onselectstart = noselect;
// document.oncontextmenu = noselect;
function noselect() {return false;}
@romanoffs
romanoffs / common.js
Created August 10, 2017 16:12
от перетаскивания картинок
$("img, a").on("dragstart", function(event) { event.preventDefault(); });