I'm not sure how you'd do this with CakePHP's helper, but I think the basic
idea is you want to set up an observer for onclick that does two things:
Effect.Fade() and Ajax.Request(). When you instantiate the Ajax.Request
object, add an OnComplete callback that makes the element appear again. If
you want to use "this" in the callback, you will need to bind it to the
callback function. In Javascript, it would go something like this (please
note this is untested):
function handleAjaxClick(event)
{
var anchor = event.findElement('a');
var url = anchor.readAttribte('href');
new Effect.Fade(anchor);
new Ajax.Request(url, {
onComplete: function()
{
new Effect.Appear(this);
}.bind(anchor)
});
}
$$(a.ajaxable).invoke('observe', 'click', handleAjaxClick);
I hope this helps.
-Hector
On Wed, Oct 8, 2008 at 8:43 AM, Arak Tai'Roth <[EMAIL PROTECTED]>wrote:
>
> Are you able to help me with this?
>
> On Oct 6, 8:28 pm, "Arak Tai'Roth" <[EMAIL PROTECTED]> wrote:
> > You got it:
> >
> > On Oct 6, 5:38 pm, "Hector Virgen" <[EMAIL PROTECTED]> wrote:
> >
> > > So on click you want it to fade, and when the Ajax request is completed
> you
> > > want it to appear?
> >
> > > On Mon, Oct 6, 2008 at 4:29 PM, Arak Tai'Roth <
> [EMAIL PROTECTED]>wrote:
> >
> > > > Anybody feel like helping me? I asked around the CakePHP group and
> > > > they say it's a Javascript error, so just checking back in here for
> > > > some help on this issue.
> >
> > > > On Sep 25, 11:45 pm, "Arak Tai'Roth" <[EMAIL PROTECTED]>
> wrote:
> > > > > So I am using the prototype and scriptaculous on my webpage that I
> am
> > > > > designing with CakePHP.
> >
> > > > > This is my link that I am using:
> >
> > > > > echo $ajax->link($html->image('/img/portfolio/small/' .
> > > > > $portfolio['Portfolio']['picture'], array('alt' =>
> > > > > $portfolio['Portfolio']['title'])), '/portfolios/view/' .
> > > > > $portfolio['Portfolio']['id'], array('update'=> 'case_study',
> > > > > 'complete' => 'Effect.Appear(\'case_study\', {duration: 2.0})'),
> null,
> > > > > false);
> >
> > > > > Long I know. I can explain it more if you want me to, but the main
> > > > > part here that is my focus and the reason I am asking on this board
> > > > > instead of the CakePHP board is this part:
> >
> > > > > array('update'=> 'case_study', 'complete' =>
> > > > > 'Effect.Appear(\'case_study\', {duration: 2.0})')
> >
> > > > > Now all of this works as it is. However what I wanted was that
> after
> > > > > the case_study div initially "appeared" was once another link was
> > > > > clicked I wanted it to fade away and have it re-appear when it was
> > > > > complete. So I thought I could add before the 'complete':
> >
> > > > > 'before' => 'Effect.Fade(\'case_study\')
> > > > > or
> > > > > 'loading' => Effect.Fade(\'case_study\')
> >
> > > > > Neither of these are working. What happens as soon as I add either
> of
> > > > > those, is the div vaguely appears and then suddenly disappears,
> never
> > > > > to appear again until another link appears and then it just
> continues
> > > > > that cycle.
> >
> > > > > I was wondering if anyone can help me with this, if not I can move
> > > > > this to the CakePHP group, just thought this was more of a
> > > > > Scriptaculous issue.
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---