headroom.js
headroom.js copied to clipboard
update jQuery plugin to be compatible with ES/CommonJS modules
After this change, the following should be possible:
import $ from "jquery";
import Headroom from "headroom.js"
import registerJQueryHeadroom from "headroom.js/dist/jQuery.headroom.js";
registerJQueryHeadroom($, Headroom);
$("header").headroom();
Added a tests for jquery, and refactored the test suite so we can run the exact same set of tests for vanilla and jquery solutions.
I'm considering bundling Headroom with the jquery plugin itself, so the above code sample would be reduced to a much less boilerplate-y:
import $ from "jquery";
import registerJQueryHeadroom from "headroom.js/dist/jQuery.headroom.js";
registerJQueryHeadroom($);
$("header").headroom();