div.controls
is vital for autoplay functionality
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
// Found at Stackoverflow: http://stackoverflow.com/questions/6060992/element-with-the-max-height-from-a-set-of-elements | |
// Credits to http://stackoverflow.com/users/139010/matt-ball | |
var maxHeight = Math.max.apply(null, $("li").map(function () | |
{ | |
return $(this).height(); | |
}).get()); |
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
$(window).scroll(function() { | |
var current = $('main section').map(function(){ | |
if($(this).offset().top < $(window).scrollTop() + $(window).height() / 2) { | |
return $(this); | |
} | |
}); | |
current = current.last().get(0); | |
$('nav.main a').removeClass('active'); | |
$('a[href=#' + current.attr('id') + ']').addClass('active'); | |
}); |
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
$.fn.centerPosition = function() { | |
"use strict"; | |
var $targets = $(this); | |
if (!$targets.length) { | |
$targets = $('.centered:visible'); | |
} | |
$targets.each(function() { |
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
(function ($) { | |
$.fn.adjustAt = function(options) { | |
var elements = $(this); | |
// Default settings merged with received options | |
var settings = $.extend({ | |
width: 0, | |
above: function(element) {}, | |
below: function(element) {}, | |
aboveRepeat: function(element) {}, | |
belowRepeat: function(element) {} |
I copied this code from chriseppstein, because it is great :)
Okay, here we go: Put this somewhere in your SASS-files. E.g. _vars.scss oder _helpers.scss, etc.
$media-queries: true !default;
$media-query-free-breakpoint: 1300px;
@mixin respond-to($min-width, $max-width: false) {
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
$(document).ready(function() { | |
// Hidden Mailtos | |
$('span.inyourfacespambot').click(function() { | |
var str = $(this).text(); | |
var re = /^(.+?@).*@(.*)$/gmi; | |
var m; | |
while ((m = re.exec(str)) !== null) { | |
if (m.index === re.lastIndex) { | |
re.lastIndex++; | |
} |
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
sips -Z 640 *.jpg |
Use case: Database entries are represented in a table. By grabbing and moving a row up or down the table, you can change the entries' order/position. The changes are submitted automatically via ajax.
- Uses jQueryUI (custom download: sortable is needed)
- newly created elements are added to the top (see route /jobs/create)
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').click(function(e) { | |
if($(this).attr('href').substr(0, 4) !== 'http') { | |
if($($(this).attr('href')).length > 0) { | |
e.preventDefault(); | |
history.pushState({}, $('title').text(), window.location.protocol + '//' + window.location.host + window.location.pathname + $(this).attr('href')); | |
$('html, body').animate({ | |
scrollTop: $($(this).attr('href')).offset().top | |
}, 500); | |
} | |
} |