$(".block")
. Если будет несколько вызовов функции - количество поисков умножайте на 2. В этой ситуации нужно сохранить найденную коллекцию в переменную и обращаться уже к ней. var $block= $(".block");
Так -- поиск будет один на все случаи.Use windowObj.addEventListener() or controlObj.addEventListener() to register a handler. The function you register receives an event object (from the UIEvent base class) that encapsulates the event information. As an event cascades down through a hierarchy and back up through the hierarchy, your handler can respond at any level, or use the UIEvent object’s stopPropagation() method to stop the event propagation at some level.
Так было бы ещё лучше.