Skip to content

Instantly share code, notes, and snippets.

@Farmatique
Farmatique / gist:83d164762277f7dc8409fc110cea8eed
Created September 8, 2016 12:48
prevent goto link by clicking on <a>
jQuery('a').on('click', function(event){
event.preventDefault();
/* other stuff */
})
/* do not group these rules */
*::-webkit-input-placeholder {
color: red;
}
*:-moz-placeholder {
/* FF 4-18 */
color: red;
}
*::-moz-placeholder {
/* FF 19+ */
@Farmatique
Farmatique / gist:4c79d40b969ae773da096782e02d29fe
Created September 26, 2016 12:52
smooth scroll to section
jQuery(document).on('click', 'a[href*="#"]:not([href="#"])', function(e) {
if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
var target = jQuery(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0)
{
alert("Browser is Safari");
}
@Farmatique
Farmatique / gist:9577367901facdb72bdad578b41112dd
Created October 4, 2016 10:35
Parallelogram-looking blocks
<ul class="skew">
<li><a href="#">Test</a>
</li>
<li><a href="#">Test 2</a>
</li>
</ul>
.skew {
overflow: hidden;
width: 100%;
display: flex;
align-items: center;
/* for Safari 8 */
display: -webkit-flex;
-webkit-align-items:center;
&:after, &:before{
content: '';
display: table;
}
&:after{
clear: both;
}
@Farmatique
Farmatique / gist:afa2e33ee1a1fb96ba91273bc6ff99dd
Last active October 26, 2016 14:36
Script for mobile dropdown menu in header with scroll
/* set height for mobile menu */
var headerHeight = 80;
jQuery('.navbar-toggle').on('click', function(){
jQuery('.navbar-collapse').delay(400).queue(function(next){
jQuery(this).css('height', window.innerHeight-headerHeight);
next();
});
})
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<meta name="format-detection" content="telephone=no">
@Farmatique
Farmatique / gist:c2b60570787268f7d72ba8955b66799f
Created November 8, 2016 11:55
Opacity for modal window (bootstrap modal)
.modal-backdrop.in {
opacity: 0.9;
background-color: black;
}