Skip to content

Instantly share code, notes, and snippets.

View maxxscho's full-sized avatar
🏠
Working from home

Markus Schober maxxscho

🏠
Working from home
View GitHub Profile
@maxxscho
maxxscho / _placeholder.scss
Created April 22, 2016 08:34
Mixin for styling the placeholder attribute on form fields
// Usage
// @include placeholder {
// font-style:italic;
// color: white;
// font-weight:100;
// }
@mixin placeholder {
::-webkit-input-placeholder {@content}
:-moz-placeholder {@content}
@maxxscho
maxxscho / smooth-scroll.js
Last active April 6, 2016 08:13
Smooth Scrolling for Jumplinks
$('a.jumplink[href^="#"]').on('click', function(event) {
event.preventDefault();
var $this = $(this),
target = $this.attr('href');
if (target && target !== "#") {
$('html, body').animate({
scrollTop: $(target).offset().top
}, 600);
@maxxscho
maxxscho / RegExNumericDecimal
Last active March 31, 2016 15:11
Regular expression for matching a number with optional decimals, with "." or "," as comma-separator. The number can be signed or unsigned.
/^\-?[0-9]+([\.|\,]{1}[0-9]{1,2})?$/
@maxxscho
maxxscho / get-url-parameter.js
Created February 25, 2016 14:10
Get an url-parameter from the current URL
var getUrlParameter = function(param) {
var pageUrl = window.location.search.substring(1);
var urlVariables = pageUrl.split('&');
for (var i = 0; i < urlVariables.length; i++) {
var parameterName = urlVariables[i].split('=');
if (parameterName[0] == param) {
return parameterName[1];
}
@maxxscho
maxxscho / isMobile.js
Created January 25, 2016 08:31
Simple Mobile Detection
isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
@maxxscho
maxxscho / _center-vertical.scss
Last active January 7, 2016 14:58
Centering the unknown
// Center a block element width unknown
// height and width horizontally and vertically
// If it doesn't center vertically, play with the spacing.
// <div class="parent">
// <div class="child">....</div>
// </div>
//
// .parent {
// ... your styles here....
// text-align:center; // if you need horizontally spacing
@maxxscho
maxxscho / target_ie10
Created May 8, 2013 07:54
Target IE10 and add class .ie10 to the HTML Element. IE10 doesn't read conditional comments!!!
if(Function('/*@cc_on return document.documentMode===10@*/')()){
document.documentElement.className+=' ie10';
}
@maxxscho
maxxscho / safari_legend_margin_fix.less
Created November 7, 2012 13:35
LESS: Safari margin bugfix
// Legend Safari fix
.legend-margin-fix(@selector, @margin) {
(~"@{selector}") {
margin-bottom: @margin;
}
(~"@{selector} + *") {
-webkit-margin-top-collapse: separate;
margin-top: @margin;
}
@maxxscho
maxxscho / index.html
Created October 31, 2012 14:02
Responsive embeded video
<!DOCTYPE html>
<!-- Add classes for each IE to the HTML Tag -->
<!--[if lt IE 7 ]><html class="ie ie6 no-js"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7 no-js"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8 no-js"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html class="no-js"> <!--<![endif]-->
<head>
<title>Responsive Video</title>