jQuery multiple selectors with window or document
css, javascript, jquery
Solution
You can use jQuery's Add() to add selectors.
$('html, body').add(document).scroll(function () {
if(Screen.detectScroll() === 'down') {
self.hide();
} else {
self.show();
}
});
Problem
I know how to use multiple CSS selectors with jQuery, but how can I bind an event listener to multiple selectors when one of them is an object, the `document` or the `window` object for instance. The following doesn't work : ``` $('html, body', document).scroll(function () { if(Screen.detectScroll() === 'down') { self.hide(); } else { self.show(); } }); ```