[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-08 Thread Micky Hulse

Ahhh, thanks to all of you, I got it working:

$('.paginate li > a').livequery('click', function(event) {
what = this.rel;
which = '#' + what;
where = this.href;
$(which).fadeOut('slow', function() {
$(which).load(where, {targ:what}, function() {
$(which).fadeIn('slow');
});
});
return false;
});

Thanks to everyone for the help!!! I definitely needed the extra
professional eyeballs. ;)

Have a great day/night.

Cheers,
Micky


[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-07 Thread Micky Hulse

Hi Wizzud, thanks for the comprehensive reply... The information you
provided should be very helpful to me... I am at work now, but plan on
fix'n up my code later tonight. :)

I will work on things a bit further and report back with my findings.

Again, many thanks! I really appreciate your time and help.

Cheers,
Micky

On Dec 7, 3:24 pm, Wizzud <[EMAIL PROTECTED]> wrote:
> There's a difference in the origin of your href between the initial
> code that 'worked' and the first posted re-try that didn't.
>
> In the first one - the working code, as was -
>
> // 'this' must be referring to some element, say X
> $('#' + this.rel) // select some other element, say Y
>   .fadeOut('slow') // fade out Y
>   .load( this.href  // load into Y using X.href ...
>  , {targ: this.rel} // ...setting param targ as X.rel
>  , function() { // 'this' refers to Y
> $(this).fadeIn('slow'); // fade in Y
>
> });
>
> In the second one - the first posted -
>
> $('#' + what) // select some element, say Y
>   .fadeOut( 'slow' // fade out Y
>  , function() { // 'this' refers to Y
> $(this)
>.load( this.href // load into Y using Y.href...
>   , {targ: what} // ...setting param targ as what
>   , function() { // 'this' refers to Y
> $(this).fadeIn('slow'); // fade in Y
>   });
>   });
>
> It's logical to assume that X and Y are different elements otherwise
> there is no point in the initial select [ $('#'+this.rel) ]. So, one
> uses X.href and the other uses Y.href.
>
> Apart from that, I can see no reason why the callback version should
> not work ( except that I would unquote targ, ie {targ:what}, not
> {'targ':what} )
>
> On Dec 7, 8:51 pm, Dave Methvin <[EMAIL PROTECTED]> wrote:
>
> > Your original code looked okay to me
>
> > BTW, this is the docs on ajax load, the other is the load event
> > binding.
>
> >http://docs.jquery.com/Ajax/load
>
> > What error are you getting? The diff with the working version seems to
> > point to a problem with the fadeOut callback...


[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-07 Thread Micky Hulse

Hi Dave, thanks for the feedback, I really appreciate your help. :)

Here is my code again:

$('.paginate li > a').livequery('click', function(event) {
what = this.rel;
$('#' + what).fadeOut('slow', function() {
$(this).load(this.href, {'targ': what}, function() {
$(this).fadeIn('slow');
});
});
return false;
});

When I click .paginate, this error keeps repeating itself over-and-
over (via Firebug), like the script is in an endless loop:

g has no properties
in jquery-1.2.1.pack... (line 11)

Also, as you can see (and if it helps), I am using the LiveQuery
plugin:



I can post a link to my test page if you think it would be helpful. :)

A billion thanks!
Cheers,
Micky

On Dec 7, 12:51 pm, Dave Methvin <[EMAIL PROTECTED]> wrote:
> Your original code looked okay to me
>
> BTW, this is the docs on ajax load, the other is the load event
> binding.
>
> http://docs.jquery.com/Ajax/load
>
> What error are you getting? The diff with the working version seems to
> point to a problem with the fadeOut callback...


[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-07 Thread Wizzud

There's a difference in the origin of your href between the initial
code that 'worked' and the first posted re-try that didn't.

In the first one - the working code, as was -

// 'this' must be referring to some element, say X
$('#' + this.rel) // select some other element, say Y
  .fadeOut('slow') // fade out Y
  .load( this.href  // load into Y using X.href ...
 , {targ: this.rel} // ...setting param targ as X.rel
 , function() { // 'this' refers to Y
$(this).fadeIn('slow'); // fade in Y
});

In the second one - the first posted -

$('#' + what) // select some element, say Y
  .fadeOut( 'slow' // fade out Y
 , function() { // 'this' refers to Y
$(this)
   .load( this.href // load into Y using Y.href...
  , {targ: what} // ...setting param targ as what
  , function() { // 'this' refers to Y
$(this).fadeIn('slow'); // fade in Y
  });
  });

It's logical to assume that X and Y are different elements otherwise
there is no point in the initial select [ $('#'+this.rel) ]. So, one
uses X.href and the other uses Y.href.

Apart from that, I can see no reason why the callback version should
not work ( except that I would unquote targ, ie {targ:what}, not
{'targ':what} )

On Dec 7, 8:51 pm, Dave Methvin <[EMAIL PROTECTED]> wrote:
> Your original code looked okay to me
>
> BTW, this is the docs on ajax load, the other is the load event
> binding.
>
> http://docs.jquery.com/Ajax/load
>
> What error are you getting? The diff with the working version seems to
> point to a problem with the fadeOut callback...


[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-07 Thread Dave Methvin

Your original code looked okay to me

BTW, this is the docs on ajax load, the other is the load event
binding.

http://docs.jquery.com/Ajax/load

What error are you getting? The diff with the working version seems to
point to a problem with the fadeOut callback...


[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-07 Thread Micky Hulse

Hi Jake, thanks for the reply, I really appreciate your help. :)

Here is a version of my code that works:

$('#' + this.rel).fadeOut('slow').load(this.href, {'targ': this.rel},
function() {
$(this).fadeIn('slow');
});

Where 'targ' is a post variable.

Basically, I would like to wait for my first effect to finish
(fadeOut), then '.load()', then (fadeIn)... Maybe I should read more
about '.animate()'? Or maybe I should be working with callbacks via
'.ajaxStart()' / '.ajaxStop()'?

I just assumed that I could put .load() within a callback function of
'fadeOut()'... so, once the fade out effect is finished, I then load
my content... Then, once loaded, the callback fades the newly loaded
content back in.

I think I just need to play around a bit more. :)

I feel like I am on right track, cut just wanted to get a little
feedback from ya'll.

Many TIA's,
Cheers,
Micky


[jQuery] Re: Code feedback... Callbacks for timing...

2007-12-07 Thread Jake McGraw
What are you trying to accomplish with load()? From the documentation:

http://docs.jquery.com/Events/load

I don't see any reference to the usage you're attempting.

- jake

On Dec 6, 2007 8:34 PM, Micky Hulse <[EMAIL PROTECTED]> wrote:

>
> Hi all, I hope my question is not too silly... I just wanted to get a
> little feedback -- basically wondering what I am doing wrong here:
>
> ..
> $('#' + what).fadeOut('slow', function() {
> $(this).load(this.href, {'targ': what}, function() {
> $(this).fadeIn('slow');
> });
> });
> ..
>
> Basically, I want to fade-out a div, then .load(), then fade the div
> back in... The above code is returning errors, but I am not sure what
> I am doing wrong.
>
> I can post more code if need be.
>
> Any help, tips, rtfm's, and/or links would be spectacular. :)
>
> Many TIA's.
> Cheers,
> Micky
>