Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery <;p>;淡出后无法显示,什么';怎么了?_Jquery - Fatal编程技术网

Jquery <;p>;淡出后无法显示,什么';怎么了?

Jquery <;p>;淡出后无法显示,什么';怎么了?,jquery,Jquery,为什么#hello可以淡出但不再显示??谢谢 <!DOCTYPE html> <html> <head> <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <meta charset=utf-8 /> <title>JS Bin</title> <!-

为什么#hello可以淡出但不再显示??谢谢

<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup,
  menu, nav, section { display: block; }
</style>
<script>
$(function() {
  $('#hello').delay(1000).fadeOut();
  $('#hello').show();
});
</script>
</head>
<body>
  <p id="hello">Hello World</p>
</body>
</html>

JS-Bin
文章、旁白、数字、页脚、页眉、H组、,
菜单,导航,部分{显示:块;}
$(函数(){
$('#hello').delay(1000.fadeOut();
$(“#您好”).show();
});

hello World


您必须通过向淡出效果提供回调来等待淡出效果完成:

$(function() {
    $('#hello').delay(1000).fadeOut('slow', function() {
      $('#hello').show();
    });
});
在启动
.fadeOut()
之前,将调用
.show()

试试这个:

$('#hello').delay(1000).fadeOut(function(){
    $('#hello').show();  
});

示例:

在您的示例中,
show()
函数在
fadeOut
完成之前被调用。如果将其更改为:

$('hello').delay(1000).fadeOut(函数(){$('hello').show()})


然后,淡出完成后,
hello
p
元素将再次出现。

它可以,问题是由于您的延迟,
.show()
.fadeOut()
之前被调用

要修复此问题,请尝试:

$('#hello').delay(1000).fadeOut().show(); //Will reappear immediately


使用淡出回调指定动画结束时要执行的操作

$(function() {
    $('#hello').delay(1000).fadeOut(function() {
        $('#hello').show();
    });
});

什么?你的问题没有道理。
$(function() {
    $('#hello').delay(1000).fadeOut(function() {
        $('#hello').show();
    });
});