Skip to content

Instantly share code, notes, and snippets.

View sshkarupa's full-sized avatar

Sergey Shkarupa sshkarupa

View GitHub Profile
@sshkarupa
sshkarupa / smooth.scroll.js
Last active August 29, 2015 14:17
smooth scroll function
//smooth scroll function
$('a[href^="#"]').click(function () {
elementClick = $(this).attr("href");
destination = $(elementClick).offset().top;
$('html,body').animate( { scrollTop: destination }, 1000 );
return false;
});
@sshkarupa
sshkarupa / ajax.submit.form.js
Last active August 29, 2015 14:17
ajax submit form
//Аякс отправка форм
//Документация: http://api.jquery.com/jquery.ajax/
$("#form").submit(function(e) {
e.preventDefault;
$.ajax({
type: "POST",
url: "mail.php",
data: $(this).serialize()
}).done(function() {
alert("Спасибо за заявку!");
@sshkarupa
sshkarupa / ful.size.jumbo.js
Created March 29, 2015 21:15
full size jumbotron
//make jumbotron adjust to full size of user's viewport on load and after resize
function adjustJumbo(){
$('.jumbotron').outerHeight($(window).height()-120);
}
adjustJumbo();
$(window).resize(function() {adjustJumbo();});
//make a red arrow under the jumbotron move with the scrolling and disappear
$(window).scroll(function() {
var coords = ($(window).scrollTop() / 6 ).toFixed(1);
@sshkarupa
sshkarupa / button
Created April 3, 2015 16:26
button.html
<div class="btn_mnu">
<div class="btn_row"></div>
<div class="btn_row"></div>
<div class="btn_row"></div>
</div>
<style>
.btn_mnu {
width: 50px;
height: 50px;
@sshkarupa
sshkarupa / button.sass
Last active August 29, 2015 14:18
button.sass
.btn_mnu
width: 50px
height: 50px
@include display-flex
flex-direction: column
align-items: center
justify-content: center
background-color: tomato
cursor: pointer
@sshkarupa
sshkarupa / magnific.js
Created April 4, 2015 19:08
magnific.js
$(".item").magnificPopup({
type : 'image',
gallery : {
enabled : true
},
removalDelay: 300,
mainClass: 'mfp-fade'
});
@sshkarupa
sshkarupa / magnific.css
Last active August 29, 2015 14:18
magnific.css
.mfp-content
width: 100%
.mfp-container
padding: 0
img.mfp-img
display: block
max-width: 100%
height: auto
@mixin font-size-em($size)
font-size: $size / $font-size-base * 1em
@mixin line-height-em($size)
line-height: $size / $font-size-base * 1em
@mixin display-flex
display: -webkit-flex
display: -moz-flex
display: -ms-flex
@sshkarupa
sshkarupa / maps.js
Created May 1, 2015 15:10
Карта google.map через api
<body onload="initialize()">
<!--
HTML-code
-->
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDUkdtaBd_1FBRCG5BMOdHILr-paQ7aTUQ&sensor=false"> //
</script>
<script type="text/javascript">
@sshkarupa
sshkarupa / icon.css
Created May 3, 2015 19:46
icon-font
// You can use data-attribute
[data-icon]:before
font-family:qlean-icons!important
content:attr(data-icon)
font-style:normal!important
font-weight:400!important
font-variant:normal!important
text-transform:none!important
speak:none