javascript - Headroom.js options with Enquire.js -
i need have different offset in headroom.js depending on screen size.
enquire.js should trick, can't work properly. loads 1 offset setting per page load, though it's right 1 on load, doesn't switch setting when resize screen.
enquire.register("screen , (max-width: 48rem)", { // required // triggered when media query transitions // *unmatched* *matched* match : function() { headroom.options = { offset : 0, }; }, // optional // triggered when media query transitions // *matched* *unmatched* unmatch : function() { headroom.options = { offset : 137, }; }, // optional // triggered once upon registration of handler setup : function() { }, // optional // defaults false // if true, defers execution of setup function // until first media query matched (still once) defersetup : true });
Comments
Post a Comment