[jQuery] Re: event fired after SlideDown

2008-04-03 Thread Yuval Hager



On Mar 26, 11:37 am, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
 Maye you can use setInterval and periodically test if your elem is visible ?


Thanks! this is exactly what I did eventually.
Here's the code, I hope its sane:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/imagefield_crop/imagefield_crop.js?revision=1.1.2.3pathrev=DRUPAL-5

--yuval


[jQuery] Re: event fired after SlideDown

2008-03-26 Thread Olivier Percebois-Garve
Maye you can use setInterval and periodically test if your elem is visible ?

On Tue, Mar 25, 2008 at 5:40 PM, Yuval Hager [EMAIL PROTECTED] wrote:


 On Mar 25, 3:35 pm, Olivier Percebois-Garve [EMAIL PROTECTED]
 wrote:
  As I am not Drupal user difficult to understand what you can do or cant.
  Basically with jQuery animations you can pass a function as last param
 and
  it
  will be executed after:
 
  $(p).slideDown(slow,function(){
alert(Animation Done.);
 
  });
 

 I wish I could, but this is called from within core drupal and I can't
 change it:

 http://cvs.drupal.org/viewvc.py/drupal/drupal/misc/collapse.js?view=markuppathrev=DRUPAL-5

  If you cant change it, it suggest you to use  setTimeout with a time
 longer
  than the time of the animation.
  I guess it will be ok most of the time, but it wont be bulletproof.
 

 Thanks - I hoped not to get into that and have an event fired when the
 element gets into view..

 (btw, the code I need to run when the animation completes is under
 $document.ready() here:

 http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/imagefield_crop/imagefield_crop.js?revision=1.1.2.1pathrev=DRUPAL-5
 )

 --yuval



[jQuery] Re: event fired after SlideDown

2008-03-25 Thread Olivier Percebois-Garve
As I am not Drupal user difficult to understand what you can do or cant.
Basically with jQuery animations you can pass a function as last param and
it
will be executed after:

$(p).slideDown(slow,function(){
  alert(Animation Done.);
});

If you cant change it, it suggest you to use  setTimeout with a time longer
than the time of the animation.
I guess it will be ok most of the time, but it wont be bulletproof.

-Olivier

On Tue, Mar 25, 2008 at 1:05 PM, Yuval Hager [EMAIL PROTECTED] wrote:


 This is probably truly basic, but I can't figure it out myself.

 The problematic code calculates and manipulates objects positioning
 (using offsetLeft and offsetTop), that runs on $(document).ready().

 It runs as a module which is part of the Drupal CMS, so I don't have
 control over some of the components.

 Usually it works well, but when used inside a div that is not
 displayed by default, rather by slideDown() function (it is called
 'collapsed' in Drupal) - all the positioning calculations fail. I
 would like to run these calculations when the slideDown event
 completes. But I don't know how can I detect slideDown completing,
 WITHOUT cooperation from the caller of slideDown...

 Thanks for your help..

 --yuval



[jQuery] Re: event fired after SlideDown

2008-03-25 Thread Yuval Hager



On Mar 25, 3:35 pm, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
 As I am not Drupal user difficult to understand what you can do or cant.
 Basically with jQuery animations you can pass a function as last param and
 it
 will be executed after:

 $(p).slideDown(slow,function(){
   alert(Animation Done.);

 });


This is what I *would* like to do, but this is given by the core
platform. You can see the source call here:
http://cvs.drupal.org/viewvc.py/drupal/drupal/misc/collapse.js?view=markuppathrev=DRUPAL-5
(sorry I didn't give this link in the original post).
My element is only a child of this fieldset, and I would like to know
when it is put in view..

 If you cant change it, it suggest you to use  setTimeout with a time longer
 than the time of the animation.
 I guess it will be ok most of the time, but it wont be bulletproof.


Yes, eventually, if I have no choice, I will have to revert to that,
although this is far from being my favorite method of coding it.
Is there some kind of an event that will fire when the element is
displayed, or when its position is calculated by the browser, or
anything similar?

I am not sure this is relevant to the dicussion, but for completeness,
here is the code that I want to run (look at the $(document).ready()
function):
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/imagefield_crop/imagefield_crop.js?revision=1.1.2.1pathrev=DRUPAL-5

Thanks,

--yuval


[jQuery] Re: event fired after SlideDown

2008-03-25 Thread Yuval Hager

On Mar 25, 3:35 pm, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
 As I am not Drupal user difficult to understand what you can do or cant.
 Basically with jQuery animations you can pass a function as last param and
 it
 will be executed after:

 $(p).slideDown(slow,function(){
   alert(Animation Done.);

 });


I wish I could, but this is called from within core drupal and I can't
change it:
http://cvs.drupal.org/viewvc.py/drupal/drupal/misc/collapse.js?view=markuppathrev=DRUPAL-5

 If you cant change it, it suggest you to use  setTimeout with a time longer
 than the time of the animation.
 I guess it will be ok most of the time, but it wont be bulletproof.


Thanks - I hoped not to get into that and have an event fired when the
element gets into view..

(btw, the code I need to run when the animation completes is under
$document.ready() here:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/imagefield_crop/imagefield_crop.js?revision=1.1.2.1pathrev=DRUPAL-5
)

--yuval