PDA

View Full Version : Scriptaculous Help


blast
01-09-2008, 06:36 PM
I have a function to show a div based on the image that is clicked...here is the JS:

function showSection(strList,id)
{
// <![CDATA[
var id;
var aList = strList.split(",");
for (i = 0; i < aList.length; i++)
{
if (aList[i] == id)
{
Effect.Appear($(aList[i]),{ duration: 1.5 });
}
else
{
Effect.Fade($(aList[i]),{ duration: 0 });
}
}
// ]]>
}


I have also tried the effects for (Shrink, Grow) but all of these dont look smooth to me.

Does anyone know if there is a way to make the animation much smoother?

GJay
01-09-2008, 10:01 PM
scripty effects can take 'fps' (frames per second) as part of the options hash, so

{duration: 1.5, fps: 25}

The default is 25, so upping it will theoretically make the animation smoother, but a lot will depend on the processing power of the client- if you're using a slow computer it will always be jerky.

(this isn't at all Ajax-related, so probably belongs in the new frameworks sub-forum!)