【发布时间】:2014-05-17 21:07:07
【问题描述】:
当用户输入错误信息时,我正在尝试对我的登录页面应用抖动效果。此时,如果用户提交了不正确的详细信息,则页面会刷新,并打印 PHP 通知,并通过 JS 使通知 div 可见。我正在尝试使用变得可见的通知来识别信息不正确并切换抖动效果。
HTML
<div class="form-container">
<form action="index.php" method="post">
<div class="logo"></div>
<p>
Sign into <i>Agito</i> by using the credentials you were sent via email. If you haven't signed up yet, click the link below.
</p>
<div class="pre-user">
<img src="../resources/img/user.png">
</div>
<input type="text" placeholder="Username" name="username"/>
<div class="pre-pass">
<img src="../resources/img/password.png">
</div>
<input type="password" placeholder="Password" name="password"/>
<a href="#">Haven't signed up yet?</a>
<input type="submit" value="Sign in"/>
</form>
</div>
在页面重新加载时打印以下内容
<div class='notification'>Sign in unsuccessful. Try again?</div>
JS
$('document').ready(function() {
$('.notification').hide();
$('.notification').slideDown();
if ($('.notification').is(':visible')) {
$('.form-container').effect( "shake" );
}
});
【问题讨论】:
标签: javascript php jquery html