PDA

View Full Version : Trouble with Scriptaculous [REPOST]



Jackboy
08-07-2008, 05:06 PM
I forgot about the coding communities stupid rule only letting members of the CC (Simon and Oli aint it?) post and nobody else.

I am have trouble fading a div from my ajax loaded page.

Moved by Invent (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks :).

Invent
08-07-2008, 05:12 PM
Just letting you know that I took a 2 week break from moderating and posting in the CC section that's why you haven't got a reply.

I've also moved your thread to a category that's more suitable.

Once I'm officially back to helping I'll try to post a fix for you.

Jackboy
08-07-2008, 05:13 PM
Just letting you know that I took a 2 week break from moderating and posting in the CC section that's why you haven't got a reply.

I'll also move your thread to a category that's more suitable.

Okay then cheers x

But this problem is doing my nut ;(

Independent
08-07-2008, 10:14 PM
Just letting you know that I took a 2 week break from moderating and posting in the CC section that's why you haven't got a reply.

I've also moved your thread to a category that's more suitable.

Once I'm officially back to helping I'll try to post a fix for you.
Woah, time has been running slow.. or you and oli haven't been that active other than them 2 weeks.

Protege
09-07-2008, 10:07 AM
Woah, time has been running slow.. or you and oli haven't been that active other than them 2 weeks. They should let me in this coding community.

-----------

This fading method isn't that good, so I'd probably look into jquery fading.


function changeOpacity ( id, opacStart, opacEnd, millisec )
{
var speed = Math.round ( millisec / 100 );
var timer = 0;

if( opacStart > opacEnd )
{
for( i = opacStart; i >= opacEnd; i-- )
{
setTimeout ( 'changeOpac(' + i + ",'" + id + '\')', ( timer * speed ) );
timer++;
}
}
else if( opacStart < opacEnd )
{
for( i = opacStart; i <= opacEnd; i++ )
{
setTimeout ( 'changeOpac(' + i + ",'" + id + '\')', ( timer * speed ) );
timer++;
}
}
}

function changeOpac ( opacity, id )
{
var object = document.getElementById( id ).style;
object.opacity = ( opacity / 100 );
object.MozOpacity = ( opacity / 100 );
object.KhtmlOpacity = ( opacity / 100 );
object.filter = 'alpha(opacity=' + opacity + ')';
}

To change the opacity of an object basically you call this func:

changeOpacity ( 'id', 0, 100, 500 );

Red -> The ID of the object, say we called the ID 'Bob'
<div id="bob"></div> (doesn't have to be a div btw.)

Orange -> Start opacity, say you want to fade from 0% (cant see)
Blue -> End opacity, you want the end result to be 100% (you can see)

Pink -> The amount of time you want the fade to go on, in milliseconds ( 500 = 0.5 seconds.. 1000 = 1second
Any problems, post your reply.

Want to hide these adverts? Register an account for free!