我创建了一个联系表单,当我单击按钮时我想从右侧滑入,单击一个单独的按钮时向后滑动。到目前为止,我只能得到.hide()方法,但当我再次单击该按钮查看表单时,它不起作用。有人可以解释为什么吗?
这是我的HTML代码
<div id="slidebottom" class="slide">
<button id="button" class="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
</button>
<div class="well">
<form action="index.html" method="post">
<button id="close_button"><a><img id="close" src="img/close.png"></a></button>
<h1 class="heading">CONTACT US</h1>
<p>Register your interest and we will inform you of latest developments</p>
<input type="text" id="name" name="user_name">
<input type="email" id="email" name="user_email">
<input type="tel" id="phone" name="user_number">
<h1 class="register">REGISTER</h1>
</form>
</div>
和我的jQuery
$(document).ready(function() {
$('#button').click(function() {
var $lefty = $(this).next();
$lefty.animate({
left: parseInt($lefty.css('left'),10) == 0 ?
-$lefty.outerWidth() :
0
});
});
});
$('#close_button').click(function() {
$('.well').hide();
});
答案 0 :(得分:0)
$(document).ready(function() {
$('#button').click(function() {
var $lefty = $(this).next();
$('.well').show();
$lefty.animate({
left: parseInt($lefty.css('left'),10) == 0 ?
-$lefty.outerWidth() :
0
});
});
});