3 Replies Latest reply on Jul 6, 2011 7:14 AM by bcn

    H:Messages - Hide After Duration

    leesy

      Hi all,

      I was just wondering if anyone has a good working example of hiding an item after a certain amount of time, if the item doesn't have anything like an onclick method, in my case h:messages.

      I've been trying with both <rich:effect> and just using the Prototype library after calling it via <a4j:loadscript>. Neither are working though.

      Cheers for any help,
      Lee

        • 1. Re: H:Messages - Hide After Duration
          leesy

          Sorry - can someone delete this message. I went back to the documentation and saw what I needed in there. Just missed it a few times.

          <rich:effect for="window" event="onload" type="Fade" params="targetId:'messageholder',delay:5" />


          • 2. Re: H:Messages - Hide After Duration
            bcn

            Hi,

             

            how can this be done in RichFaces 4 where rich:effect is gone?

             

            Thanks

            • 3. Re: H:Messages - Hide After Duration
              bcn

              For anyone interested, I found a way (without rich: tags):

               

              <h:outputScript name="jquery.js" />

              <h:outputScript>

              jQuery(document).ready(function() {

                  jQuery('#global_messages').ready(function() {

                      if ('#{view.viewId}' == '/index.xhtml' &amp;&amp; '#{facesContext.maximumSeverity}'.substring(0, 4) == 'INFO') {

                          jQuery('#global_messages').delay(5000).slideUp(2000);

                      }

                  });

              });

              </h:outputScript>

               

              <h:messages  id="global_messages" />