Skip to content

Instantly share code, notes, and snippets.

@scamartist26
scamartist26 / smoothscroll.js
Last active August 29, 2015 13:56
smooth page scroll
// requires jQuery and jQuery Easing
var $ = jQuery.noConflict();
function smoothScroll(element, speed, effect, offset) {
$(element).bind('click', function (event) {
$('html, body').stop().animate({
scrollTop: ($($(this).attr('href')).offset().top) - offset
}, speed, effect);
event.preventDefault();
});
}
@scamartist26
scamartist26 / tab-justify.js
Last active August 29, 2015 13:56
Twitter Bootstrap Tab navigation width and height justification plugin.
var $ = jQuery.noConflict();
function justifyTabs(){
var count = $('.nav-tabs > li > a').length, // set how many tabs
allHeights = []; // create array holder for the heights of our tabs
$('.nav-tabs > li').each(function () {
$(this).css('width', 100 / count + '%'); // set WIDTH based on how many tabs we have
var itemHeight = $(this).outerHeight(); // get HEIGHT of this item
allHeights.push(itemHeight); // add item HEIGHT to array
});
@scamartist26
scamartist26 / genesis_nav_menu
Last active August 29, 2015 14:16
genesis nav menu less
.genesis-nav-menu {
clear: both;
font-size: 16px;
line-height: 1;
width: 100%;
.menu-item {
display: inline-block;
text-align: left;
@scamartist26
scamartist26 / index.html
Created July 19, 2018 16:06
Lazy Load for Background Images (using JS)
<h1>Lazy Load for background Images</h1>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_mrraktQTCS1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_mufr0mmWYW1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_mr80snx79b1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_mrraktQTCS1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_msuei3sMTo1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_mtw7mhZsCe1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_msuei3sMTo1st5lhmo1_1280.jpg"></div>
<div data-background-image-url="https://s3-us-west-2.amazonaws.com/s.cdpn.io/25381/tumblr_muf