headroom.js icon indicating copy to clipboard operation
headroom.js copied to clipboard

update jQuery plugin to be compatible with ES/CommonJS modules

Open WickyNilliams opened this issue 4 years ago • 2 comments

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();

WickyNilliams avatar Sep 11 '19 14:09 WickyNilliams

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.

WickyNilliams avatar Sep 16 '19 15:09 WickyNilliams

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();

WickyNilliams avatar Sep 16 '19 15:09 WickyNilliams