Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Slide up/slide down

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30115
    GreatPotato
    Member

    I have the following:


    $(document).ready(function() {
    $("#slide-out").click(function(){
    $("#switcher-toggle").animate({
    top: "-65px",
    }, 200 );
    });
    });

    Which makes my div slide up out of the screen nicely when clicked… But I want it to slide back down when “#slide-out” is clicked again…

    Anyway help?

    #76542
    Azra
    Participant

    Shouldn’t it be something like

    $('a').click(function () {
    $('#whatever').slideToggle(600);
    });
    #80759
    GreatPotato
    Member

    Yeh but essentially my click button is part of the DIV that is sliding so if I use toggle the link is gone – I will experiment today

    #80732
    Rob MacKay
    Participant

    Toggle has a callback feature – I think works like this…

    $(document).ready(function() {
    $("#slide-out").toggle(function(){

    $("#switcher-toggle").animate({
    top: "-65px",
    }, 200} );

    }, function() {

    $("#switcher-toggle").animate({
    top: "65px",
    }, 200} );

    });
    });
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.