0 Replies Latest reply on Aug 23, 2010 12:05 PM by J Miller

    Send effects params via javascript function?

    J Miller Newbie

      I'm new to using RichFaces, and couldn't find an answer to this in my searches, so please forgive me if this has been covered somewhere and I missed it.

       

      I'm trying to send parameters to a richfaces effect function on the fly using javascript functions.  I currently have a javascript function that resizes a DIV, and keeps track of a variable that remembers what the current size is, so that when the user wants to enlarge/shrink the box, it knows what size to make it.   Right now it works, but I'd like to improve the asthetics by using the Morph effect.  Here's a simplified version of how I'm doing it now:

       

       

      ...

      function enlargeDiv(){
          divWidth = divWidth + 100;   
          document.getElementById("myDiv").style.width = divWidth;

      }

      ...

       

       

      I can morph the box using richfaces effects, but I can't figure out how to do it when the width will keep changing.  I know how to call the effect from a javascript function if all the params are defined in the richfaces code like this:

       

      <rich:effect name="resizeDiv" for="myDiv" type="Morph" params="style:'width:500px',duration:0.8" />

       

      But I can't figure out how to put those params in the javascript function call.  Or better yet, is there a way to tell the richfaces call to increase/decrease the size by a certain amount, rather than telling it the exact px size?  Something like "params='style:width:+100px"?

       

      Any ideas?

       

      Thanks