Skip to content

Instantly share code, notes, and snippets.

View tahavn's full-sized avatar

Vitalik Tkachenko tahavn

View GitHub Profile
@tahavn
tahavn / autoheight textarea
Created May 24, 2020 12:41
autoheight textarea
//автовысота textarea начало
var textArea = document.querySelectorAll('.control textarea');
for (var i = 0; i < textArea.length; i++) {
textArea[i].addEventListener('input', function () {
this.style.height = (this.scrollHeight) + "px";
})
}
//автовысота textarea конец
@tahavn
tahavn / check ie11
Last active May 25, 2020 08:31
check ie11
var ie11Styles = [
'msTextCombineHorizontal'];
var s = document.body.style,
brwoser = null,
property;
for (var i = 0; i < ie11Styles.length; i++) {
property = ie11Styles[i];
if (s[property] != undefined) {
<script>
var i = new Image;
i.onload = i.onerror = function () {
document.documentElement.classList.add(i.height == 1 ? "webp" : "no-webp")
};
i.src = "data:image/webp;base64,UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==";
</script>
if(window.devicePixelRatio >= 1.2){
var serviceThumb = document.querySelectorAll('.service__thumb[data-2x]');
for(var i = 0; i < serviceThumb.length; i++){
var attr = serviceThumb[i].getAttribute('data-2x');
if(attr){
serviceThumb[i].style.cssText += 'background-image: url(' + attr + ')';
}
}
}
@tahavn
tahavn / common.scss
Created October 14, 2017 16:00
common.scss
html, body {
height: 100%;
position: relative;
font-family: $font;
font-size: 16px;
color: $txt-color;
overflow-X: hidden;
-webkit-overflow-scrolling: touch;
@tahavn
tahavn / scroll to the section
Created June 20, 2017 20:23
scroll to the section
/*============================== Start Smooth scroll to the section js ==============================*/
$('.nav-list').click(function(e) {
e.preventDefault();
var currentList = $(this).attr('href');
var currentListOffset = $(currentList).offset().top;
$('html, body').animate({
scrollTop: currentListOffset - 50
@tahavn
tahavn / Slick Carousel
Last active July 27, 2018 19:21
Slick Carousel
@tahavn
tahavn / Yandex Cards
Created June 20, 2017 20:07
Yandex Cards
/*============================== Start Yandex Carts html ==============================*/
<div class="maps">
<div id="map" class="map"></div>
</div>
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
/*============================== Start Yandex Carts html ==============================*/
@tahavn
tahavn / darken() & lighten()
Created June 20, 2017 19:57
darken() & lighten()
https://codepen.io/baudoin/pen/HdliD
@tahavn
tahavn / button
Last active July 22, 2017 06:57
button
.button {
font-family: $font;
font-size: 14px;
text-transform: uppercase;
white-space: nowrap;
color: $accent;
position: relative;
padding: 13px 29px;
line-height: 17px;
background-color: $bg-color;