Forums

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

Home Forums JavaScript Slide Animation: Sliding Back

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #167737
    siouxfan45
    Participant

    The javascript animation below moves the .whole CSS class 200px (from left to right) when I click a button named .mobile-btn.

    What would I add to this script to make the animation slide back when the button is clicked again?

    http://jsfiddle.net/ct2Wd/

    <script type="text/javascript">
    $('.mobile-btn').click(function(event) {
        value = $('.whole').css('right') === '200px' ? 0 : '200px';
          $('.whole').animate({
              left: value
          });
    });
    </script>
    
Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.