jquery $.slideUp() 工作得很好,但 $.slideDown() 根本不起作用
我见过的人jQuery:slideUp()延迟()然后slideDown;不工作,我完全编码:
$('.flash_message').slideDown(800).delay(5000).slideUp(1000);
但slideDown似乎不起作用。
换句话说:
``$('.flash_message').slideDown(800).delay(5000).slideUp(1000);`
和
$('.flash_message').delay(5000).slideUp(1000 );
产生相同的结果!
生成 .flash_message
元素的 PHP 代码:(我使用 codeigniter)
if ($this->session->flashdata('message_array'))
{
foreach($this->session->flashdata('message_array') as $message)
{
echo "<div class='flash_message {$message[0]}'>{$message[1]}</div>";
}
}
生成的示例 HTML:
<div class="flash_message success">Event added successfully.</div>
更新:我遇到了问题:
slideDown 根本不起作用
$( '.flash_message').slideDown(800);
不执行任何操作!
Guys I've seen jQuery: slideUp() delay() then slideDown; not working, I exactly coded:
$('.flash_message').slideDown(800).delay(5000).slideUp(1000);
but the slideDown doesn't seem to work.
In other words:
``$('.flash_message').slideDown(800).delay(5000).slideUp(1000);`
and
$('.flash_message').delay(5000).slideUp(1000);
are producing the same result!
PHP code that generates .flash_message
element: (I use codeigniter)
if ($this->session->flashdata('message_array'))
{
foreach($this->session->flashdata('message_array') as $message)
{
echo "<div class='flash_message {$message[0]}'>{$message[1]}</div>";
}
}
Sample HTML generated:
<div class="flash_message success">Event added successfully.</div>
Updated: I GOT THE PROBLEM:
slideDown doesn't work at all
$('.flash_message').slideDown(800);
doesn't do anything!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将延迟和slideUp 放入初始slideDown 函数的回调中,
回调中的代码将在slideDown 完成后执行。
这是一个 jsfiddle - http://jsfiddle.net/FK2Fd/1/
You should place the delay and the slideUp into the callback of the initial slideDown function
Code in the callback will be executed once the slideDown has finished.
Heres a jsfiddle - http://jsfiddle.net/FK2Fd/1/