user1739696
user1739696

Reputation: 127

.css display animation issues

Hi I'd have put together basic jquery to make a menu at the top of a page appear, can I make this slide in from the top rather than just appear suddenly. I've tried to use .animate but couldn't place it correctly

    $(document).ready(function() {
  $('#toggle').click(function(){
    $('div.menu').css('display', 'block');
  });
});

Upvotes: 0

Views: 32

Answers (1)

Igor Jerosimić
Igor Jerosimić

Reputation: 13741

You can use slide functions from jQuery library. slideDown to open, slideUp to hide.

$(document).ready(function() {
  $('#toggle').click(function(){
    $('div.menu').slideDown('slow');
  });
});

Upvotes: 1

Related Questions