This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin optional-at-root($sel) { | |
@at-root #{if(not &, $sel, selector-append(&, $sel))} { | |
@content; | |
} | |
} | |
@mixin placeholder { | |
@include optional-at-root('::-webkit-input-placeholder') { | |
@content; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin clearfix() { | |
&:before, | |
&:after { | |
content: ""; | |
display: table; | |
} | |
&:after { | |
clear: both; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var height = (window.innerHeight > 0) ? window.innerHeight : screen.height; | |
// var width = (window.innerWidth > 0) ? window.innerWidth : screen.width; | |
$(function() { | |
$(window).on('load resize orientationchange', function() { | |
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width; | |
if ( width <= 777 && width > 480 ) { | |
// do smthng | |
} else if ( width <= 480 ) { | |
// do smthng |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href*="#"]:not([href="#"])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
var target = $(this.hash); | |
target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
position = $(window).scrollTop(); | |
$('html, body').animate({ | |
scrollTop: target.offset().top | |
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.outer { | |
width: 200px; | |
height: 500px; | |
text-align: center; | |
background-color: #ffc; | |
} | |
.outer:after { | |
display: inline-block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Vertical align */ | |
.d-flex-vertical { | |
/* Tell flexbox to start vertically from the center */ | |
align-items:center; | |
display:flex; | |
/* I'm also aligning it horizontally */ | |
justify-content:center; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if lt IE 9]> | |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajaxSetup({ // if Firefox => JSON "not well-formated" | |
beforeSend: function(xhr){ | |
if (xhr.overrideMimeType) | |
{ | |
xhr.overrideMimeType("application/json"); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This parent can be any width and height */ | |
.block { | |
text-align: center; | |
/* May want to do this if there is risk the container may be narrower than the element inside */ | |
white-space: nowrap; | |
} | |
/* The ghost, nudged to maintain perfect centering */ | |
.block:before { |
NewerOlder