JQuery: How to select window and some other divs by id?

I have a context menu that pops up whenever a click happens at a certain div inside a container and I want it to hide if either the window element or its container is scrolled. How can I add the 'window' element in there?



If i understand your question, try:


If not, please consider to provide a jsFiddle which replicates your issue

You can add a scroll handler directly to the window like

$( window ).scroll(function() {
     //Do stuff

(Per "Example: To do something when your page is scrolled" of http://api.jquery.com/scroll/)

Need Your Help

Prevent wrapping <span> tags for ASP.NET server control

asp.net servercontrols

I am writing various ASP.NET Server controls and am needing to remove the tags that wrap my control by default. I am aware that you can change the tag to a different tag (as in this question, How ...

Show multiple output-tabs in NetBeans

netbeans tabs output

I've got two projects: Server and Client. I receive two separate outputs in two separate tabs for every project I run as seen on the following picture: