Thanks Mike, that works well.

Further to this, I am trying to have a function called only when the
toggle is "open" or active, e.g.:

$('#rides_button').click(function () {
        $('#rides').slideToggle("slow", function () {
                $.getJSON("rides.php", function(data) {

                        [...]

                        });
                });
        });


As you can see, the rides.php script only really needs to be called
when the DIV opens (slideDown), but in this case it's called on
slideUp as well. ... Not sure of the proper approach to use here...

...Rene


On Aug 11, 7:22 pm, mikebob <[EMAIL PROTECTED]> wrote:
> The animatefunctionhas a callback parameter that you can use when
> the animation completes.  Then you must rebind the click event to
> something different.  Try something like this Rene.
>
>     $("#go1").click(function(){
>       $("#block1").animate( { width:"90%" }, 1500, "",function() {
>                 $("#go1").unbind("click").click(function(){
>                         $("#block1").css({width:""});
>                 });
>           });
>     });
>
> On Aug 11, 5:19 am, René <[EMAIL PROTECTED]> wrote:
>
> > I have a similar question... I want to animate atogglebetween two
> > widths, a la:
>
> >     $("h2").click(function(){
> >                 $(this).toggleClass("active");
> >                 $("div#panel").animate({ width: "200px" });
> >                 $(this).next("ul").slideToggle("fast");
> >         });
>
> > This works on the first click--the div#panel smoothly widens. But of
> > course when h2 is clicked again, it doesn't change. Can anyone suggest
> > how to add the animation in reverse, that is back to the starting
> > width?
>
> > ...Rene
>
> > On Aug 10, 10:46 pm, "John Resig" <[EMAIL PROTECTED]> wrote:
>
> > > Do you have a sample page up? It would help to diagnose what's going on.
>
> > > --John
>
> > > On Sun, Aug 10, 2008 at 3:00 PM, Russell <[EMAIL PROTECTED]> wrote:
>
> > > > Hi there,
>
> > > > I am pretty new to JQuery. I hope someone can answer these questions
> > > > for me.
>
> > > > I have some links on top of the page that are fixed in the center and
> > > > a single division
> > > > that is fixed in the middle of the page bellow them. I wanted to know
> > > > how I could animate
> > > > the division to resize itself and populate it with text, images, etc.
> > > > when I click on a link.
> > > > The links are external .html
>
> > > > I tried using this just to test:
>
> > > > $(document).ready(function() {
> > > >        $("li.action-one").click(function(){
> > > >                $("#content").animate({
> > > >                        width: "300px"
> > > >                });
> > > >        });
> > > >        $("li.action-one").click(function(){
> > > >                $("#topic").toggle();
> > > >        });
> > > > });
>
> > > > The topic div is in the content div and is hidden. I cant seem to make
> > > > animate andtoggle
> > > > to work on the same link...if I take out one, it works.

Reply via email to