Reputation: 1133
I want to create an order form. I have the following:
How can I animate it to slide down and up? I know the function .slideDown() / .slideUp() or .slideToggle. But I want to animate the button too. So, it's getting difficult for me.
Second question: Can I realize that without images?
Upvotes: 0
Views: 2527
Reputation: 123
Use CSS to shape the handle instead of images and gradients for the background, but this should serve as a starting point for you.
$("#handler").click(function(){
$('#opener, #closer').toggle();
var container = $( "#container" ),
mt = container.css('margin-top').split('px')[0],
op = (mt<0)?'+=169px':'-=169px';
container.animate({
'margin-top': op
}, 500);
});
Upvotes: 0
Reputation: 4418
You can do it using postion: absolute
to button.
Check if this helps you. http://codepen.io/anon/pen/wakgp
Upvotes: 0
Reputation: 3527
Use jquery animate for margin-top. It looks better then animating height:
$("#handler").click(function(){
$('#opener, #closer').toggle();
var container = $( "#container" ),
mt = container.css('margin-top').split('px')[0],
op = (mt<0)?'+=169px':'-=169px';
container.animate({
'margin-top': op
}, 500);
});
Here is an example: JSFiddle
Upvotes: 2