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();
}
});
You can use jQuery's Add() to add selectors.
$('html, body').add(document).scroll(function () {
if(Screen.detectScroll() === 'down') {
self.hide();
} else {
self.show();
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.