Skip to content

Instantly share code, notes, and snippets.

@omurphy27
omurphy27 / Jquery Smooth Scrolling for Bootstrap Scroll Spy Nav.js
Created January 15, 2015 22:30
Jquery Smooth Scrolling for Bootstrap Scroll Spy Nav.js
// simple smooth scrolling for bootstrap scroll spy nav
// credit http://stackoverflow.com/questions/14804941/how-to-add-smooth-scrolling-to-bootstraps-scroll-spy-function
$(".navbar-nav li a[href^='#']").on('click', function(e) {
// prevent default anchor click behavior
e.preventDefault();
// store hash
var hash = this.hash;
@omgmog
omgmog / parallax-scroll.js
Created October 28, 2013 15:26
Simple parallax background scrolling with jQuery
$(function() {
var $el = $('.parallax-background');
$(window).on('scroll', function () {
var scroll = $(document).scrollTop();
$el.css({
'background-position':'50% '+(-.4*scroll)+'px'
});
});
});