Skip to content

Instantly share code, notes, and snippets.

var gistPrefix = 'https://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('a.gist').map(function(n, a) {
a = $(a);
var href = a.attr('href');
@jonathan-beebe
jonathan-beebe / jquery-scrolllock.js
Last active August 29, 2015 13:56 — forked from theftprevention/jquery-scrolllock.js
A small jQuery extension that disables the propagation of scroll events from the first element in the set of matched elements. Original function by Troy Alford of Stack Overflow. $("#object").scrollLock() enables the lock, and .scrollRelease() disables it. In response to this SO question: http://stackoverflow.com/a/16324762/123781
$.fn.scrollLock = function () {
return $(this).on("DOMMouseScroll mousewheel", function (h) {
var g = $(this),
f = this.scrollTop,
d = this.scrollHeight,
b = g.height(),
i = h.originalEvent.wheelDelta,
a = i > 0,
c = function () {
h.stopPropagation();