What''s the best way to listen to all events of a specific type for an entire document? I tried adding an ID attribute to the body tag and then explicitly informing the body element to observe "click" events, but for information that was inserted into the body by javascript, the observed function was did not fire. What I''m looking to do is try to make sure that only events which come from within an element that has a higher z-index than the other elements on the page actually get completed under certain conditions. More exactly, I''ve written my own class to open and close dialogs with content that is fetch via Ajax and loaded into positioned divs on screen. Some of those dialogs open other dialogs when a help icon is clicked. But, even when the help dialog is open, if the visitor clicks buttons in the dialog which opened the help dialog, the events for those buttons fire. I''m wondering if there''s a simple way to capture all events on a page and sift them through a global check to determine (1) if a dialog is shown and (2) if so, did this event come from the dialog with the greatest z-index, and (3) if so, continue with the event; otherwise stop it. I did think of adding code to the top of all event handlers in the program to check to see if div containing the element which fired an event has the highest z-index, but theres a lot of pre-existing code to sift through which I could do, but if there''s a simpler way, that would be excellent. -- Dash -- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
It almost sounds as if you''re making a modal dialog. If that is the case, the common technique for disabling interactions with the rest of the document is to create an "iframe shim" that covers the entire document, and is 1 z-index lower than the dialog (but at least 1 higher than everything else). Doing that prevent any interactions with the underlying document, and does not rely on you creating some uber-complex z-index order management object like you were describing. On 4/23/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> > > What''s the best way to listen to all events of a specific type for an > entire document? I tried adding an ID attribute to the body tag and > then explicitly informing the body element to observe "click" events, > but for information that was inserted into the body by javascript, the > observed function was did not fire. What I''m looking to do is try to > make sure that only events which come from within an element that has a > higher z-index than the other elements on the page actually get > completed under certain conditions. > > More exactly, I''ve written my own class to open and close dialogs with > content that is fetch via Ajax and loaded into positioned divs on > screen. Some of those dialogs open other dialogs when a help icon is > clicked. But, even when the help dialog is open, if the visitor clicks > buttons in the dialog which opened the help dialog, the events for those > buttons fire. I''m wondering if there''s a simple way to capture all > events on a page and sift them through a global check to determine (1) > if a dialog is shown and (2) if so, did this event come from the dialog > with the greatest z-index, and (3) if so, continue with the event; > otherwise stop it. > > I did think of adding code to the top of all event handlers in the > program to check to see if div containing the element which fired an > event has the highest z-index, but theres a lot of pre-existing code to > sift through which I could do, but if there''s a simpler way, that would > be excellent. > > -- Dash -- > > > >-- Ryan Gahl Software Architect WebWidgetry.com / MashupStudio.com Future Home of the World''s First Complete Web Platform Inquire: 1-262-951-6727 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Yeah, I have that for the first dialog, but if that dialog opens a help message (or an error message) I don''t want the buttons on the original one to work. I didn''t want to have to add a new shim for each dialog, but it may not be too bad to do so. - dash - Ryan Gahl wrote:> It almost sounds as if you''re making a modal dialog. If that is the case, > the common technique for disabling interactions with the rest of the > document is to create an "iframe shim" that covers the entire document, and > is 1 z-index lower than the dialog (but at least 1 higher than everything > else). Doing that prevent any interactions with the underlying document, and > does not rely on you creating some uber-complex z-index order management > object like you were describing. > > On 4/23/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > >> What''s the best way to listen to all events of a specific type for an >> entire document? I tried adding an ID attribute to the body tag and >> then explicitly informing the body element to observe "click" events, >> but for information that was inserted into the body by javascript, the >> observed function was did not fire. What I''m looking to do is try to >> make sure that only events which come from within an element that has a >> higher z-index than the other elements on the page actually get >> completed under certain conditions. >> >> More exactly, I''ve written my own class to open and close dialogs with >> content that is fetch via Ajax and loaded into positioned divs on >> screen. Some of those dialogs open other dialogs when a help icon is >> clicked. But, even when the help dialog is open, if the visitor clicks >> buttons in the dialog which opened the help dialog, the events for those >> buttons fire. I''m wondering if there''s a simple way to capture all >> events on a page and sift them through a global check to determine (1) >> if a dialog is shown and (2) if so, did this event come from the dialog >> with the greatest z-index, and (3) if so, continue with the event; >> otherwise stop it. >> >> I did think of adding code to the top of all event handlers in the >> program to check to see if div containing the element which fired an >> event has the highest z-index, but theres a lot of pre-existing code to >> sift through which I could do, but if there''s a simpler way, that would >> be excellent. >> >> -- Dash -- >> >> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Oh... OK then, just move the shim up in front of the original window then (and back down when the help thing closes). On 4/23/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote:> > > Yeah, I have that for the first dialog, but if that dialog opens a help > message (or an error message) I don''t want the buttons on the original > one to work. I didn''t want to have to add a new shim for each dialog, > but it may not be too bad to do so. > > - dash - > > Ryan Gahl wrote: > > It almost sounds as if you''re making a modal dialog. If that is the > case, > > the common technique for disabling interactions with the rest of the > > document is to create an "iframe shim" that covers the entire document, > and > > is 1 z-index lower than the dialog (but at least 1 higher than > everything > > else). Doing that prevent any interactions with the underlying document, > and > > does not rely on you creating some uber-complex z-index order management > > object like you were describing. > > > > On 4/23/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > > > >> What''s the best way to listen to all events of a specific type for an > >> entire document? I tried adding an ID attribute to the body tag and > >> then explicitly informing the body element to observe "click" events, > >> but for information that was inserted into the body by javascript, the > >> observed function was did not fire. What I''m looking to do is try to > >> make sure that only events which come from within an element that has a > >> higher z-index than the other elements on the page actually get > >> completed under certain conditions. > >> > >> More exactly, I''ve written my own class to open and close dialogs with > >> content that is fetch via Ajax and loaded into positioned divs on > >> screen. Some of those dialogs open other dialogs when a help icon is > >> clicked. But, even when the help dialog is open, if the visitor clicks > >> buttons in the dialog which opened the help dialog, the events for > those > >> buttons fire. I''m wondering if there''s a simple way to capture all > >> events on a page and sift them through a global check to determine (1) > >> if a dialog is shown and (2) if so, did this event come from the dialog > >> with the greatest z-index, and (3) if so, continue with the event; > >> otherwise stop it. > >> > >> I did think of adding code to the top of all event handlers in the > >> program to check to see if div containing the element which fired an > >> event has the highest z-index, but theres a lot of pre-existing code to > >> sift through which I could do, but if there''s a simpler way, that would > >> be excellent. > >> > >> -- Dash -- > >> > >> > > > > > > > > > >-- Ryan Gahl Software Architect WebWidgetry.com / MashupStudio.com Future Home of the World''s First Complete Web Platform Inquire: 1-262-951-6727 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
/me smacks forehead. Thanks, Ryan. Stupid Monday ;) -- Dash -- Ryan Gahl wrote:> Oh... OK then, just move the shim up in front of the original window then > (and back down when the help thing closes). > > On 4/23/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: > >> Yeah, I have that for the first dialog, but if that dialog opens a help >> message (or an error message) I don''t want the buttons on the original >> one to work. I didn''t want to have to add a new shim for each dialog, >> but it may not be too bad to do so. >> >> - dash - >> >> Ryan Gahl wrote: >> >>> It almost sounds as if you''re making a modal dialog. If that is the >>> >> case, >> >>> the common technique for disabling interactions with the rest of the >>> document is to create an "iframe shim" that covers the entire document, >>> >> and >> >>> is 1 z-index lower than the dialog (but at least 1 higher than >>> >> everything >> >>> else). Doing that prevent any interactions with the underlying document, >>> >> and >> >>> does not rely on you creating some uber-complex z-index order management >>> object like you were describing. >>> >>> On 4/23/07, David Dashifen Kees <dashifen-NT0ononE2K1Wk0Htik3J/w@public.gmane.org> wrote: >>> >>> >>>> What''s the best way to listen to all events of a specific type for an >>>> entire document? I tried adding an ID attribute to the body tag and >>>> then explicitly informing the body element to observe "click" events, >>>> but for information that was inserted into the body by javascript, the >>>> observed function was did not fire. What I''m looking to do is try to >>>> make sure that only events which come from within an element that has a >>>> higher z-index than the other elements on the page actually get >>>> completed under certain conditions. >>>> >>>> More exactly, I''ve written my own class to open and close dialogs with >>>> content that is fetch via Ajax and loaded into positioned divs on >>>> screen. Some of those dialogs open other dialogs when a help icon is >>>> clicked. But, even when the help dialog is open, if the visitor clicks >>>> buttons in the dialog which opened the help dialog, the events for >>>> >> those >> >>>> buttons fire. I''m wondering if there''s a simple way to capture all >>>> events on a page and sift them through a global check to determine (1) >>>> if a dialog is shown and (2) if so, did this event come from the dialog >>>> with the greatest z-index, and (3) if so, continue with the event; >>>> otherwise stop it. >>>> >>>> I did think of adding code to the top of all event handlers in the >>>> program to check to see if div containing the element which fired an >>>> event has the highest z-index, but theres a lot of pre-existing code to >>>> sift through which I could do, but if there''s a simpler way, that would >>>> be excellent. >>>> >>>> -- Dash -- >>>> >>>> >>>> >>> >>> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---