Skip to content

Instantly share code, notes, and snippets.

View AlexKardone's full-sized avatar

Alexander Matskevich AlexKardone

View GitHub Profile
@AlexKardone
AlexKardone / gist:2d06f4e77966d58e1d11042fe9e05627
Created September 14, 2018 08:20
Выравнивание по вертикали внутри блока без заданной высоты
https://learn.javascript.ru/css-center
Если центрируются не-блочные элементы, например inline или inline-block, то vertical-align может решить задачу без всяких таблиц.
Правда, понадобится вспомогательный элемент (можно через :before).
Пример:
<style>
.before {
display: inline-block;
@AlexKardone
AlexKardone / Sticky footer (bootstrap version) - css
Last active July 2, 2018 08:50
Sticky footer (bootstrap version)
@AlexKardone
AlexKardone / Smooth scrolling (on scrolldown button)
Last active February 18, 2018 16:05
Smooth scrolling (on scrolldown button)
$("body").on('click', '[href*="#"]', function(e){
var fixed_offset = 100;
$('html,body').stop().animate({ scrollTop: $(this.hash).offset().top - fixed_offset }, 1000);
e.preventDefault();
});
@AlexKardone
AlexKardone / Smooth Scroll to top button + font awesome 1
Created February 6, 2018 05:08
Smooth Scroll to top button + font awesome
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<div class='thetop'></div>
<div class='testheight'>Some exciting content... Scroll down for the button to appear.<br><br>
<i class="fa fa-4x fa-thumbs-up fa-spin"></i>
</div>
<div class='scrolltop'>
<div class='scroll icon'><i class="fa fa-4x fa-angle-up"></i></div>
</div>
@AlexKardone
AlexKardone / Menu-gamburger
Last active January 26, 2018 19:44
Menu-gamburger with animation. Three variants
https://codepen.io/YRaj/pen/jYmqjb
@AlexKardone
AlexKardone / Подгонка ширины блока под ширину окна - js
Last active January 26, 2018 19:12
Подгонка ширины блока под ширину окна
function widthDetect() {
$('.class-name').css('width', $(window).width());
};
$(window).resize(function() {
widthDetect();
});
@AlexKardone
AlexKardone / gist:27372bacc38ac79fdeb79c40faf280e6
Created November 26, 2017 09:36
Линия слева и справа от текста
http://dimox.name/verstka-zagolovka-s-gorizontalnoj-liniej-sleva-i-sprava-ot-teksta/
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
@AlexKardone
AlexKardone / gist:abde216e0eea6ce0ece300a8e3162299
Created October 24, 2017 08:32
Хедер на всю высоту и автоматическое подстраивание под изменение высоты окна
// Хедер на всю высоту и автоматическое подстраивание под изменение высоты окна
function heightDetect() {
// height header equals height of screen
$(".main_head").css('height', $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
@AlexKardone
AlexKardone / css
Created October 18, 2017 07:33
Grid Holy Grail on display: table
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
}
.wrap {