Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.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状态框弹出并在短时间后隐藏_Jquery - Fatal编程技术网

jquery状态框弹出并在短时间后隐藏

jquery状态框弹出并在短时间后隐藏,jquery,Jquery,我正在尝试使用jquery开发一个状态框,所以我有一个按钮,当按钮被点击时,状态框将弹出,显示类似“button is clicked”的消息,并在10秒钟后消失,但我不确定如何操作。 我认为代码可能是这样的: <input type="button" id="status" value = "show status box"/> <script> $("#status").click(function(){ //not sure what s

我正在尝试使用jquery开发一个状态框,所以我有一个按钮,当按钮被点击时,状态框将弹出,显示类似“button is clicked”的消息,并在10秒钟后消失,但我不确定如何操作。 我认为代码可能是这样的:

  <input type="button" id="status" value = "show status box"/>

  <script>
   $("#status").click(function(){
      //not sure what should be inside?
     }
   </script>

$(“#状态”)。单击(函数(){
//不知道里面应该是什么?
}

$(“#状态”)。单击(函数(){
$(“#新#盒”).show(0).delay(10000).hide(0);
});
旁注:末尾缺少一个括号


$(“#状态”)。单击(函数(){
$(“#新#盒”).show(0).delay(10000).hide(0);
});
旁注:您在结尾缺少一个括号

类似的内容

html

<button id="status">show status box</button>
<div id="statusmessage"></div>
jquery

$("#status").click(function() {
    $('#statusmessage').text('#status button was clicked..').animate({'margin-bottom':0},200);
    setTimeout( function(){
        $('#statusmessage').animate({'margin-bottom':-25},200);
    }, 5*1000);
});
像这样的演示

html

<button id="status">show status box</button>
<div id="statusmessage"></div>
jquery

$("#status").click(function() {
    $('#statusmessage').text('#status button was clicked..').animate({'margin-bottom':0},200);
    setTimeout( function(){
        $('#statusmessage').animate({'margin-bottom':-25},200);
    }, 5*1000);
});

另一种形式的演示。我喜欢《创世记》的那部,但更多的种类

$("#new_box").show(200, function(){ 
  setTimeout(function(){ $("#new_box").hide(200) }, 10000) 
});

另一种形式。我喜欢《创世记》的那部,但更多的种类

$("#new_box").show(200, function(){ 
  setTimeout(function(){ $("#new_box").hide(200) }, 10000) 
});

它可以是简单的,也可以是复杂的。您甚至可以动态地构建元素

$(“输入”)。单击(函数(){
$(“”).css({
}).html(“”.find(“div”).css({
位置:“固定”,
宽度:“100%”,
高度:“100%”,
左:“0px”,
顶部:“0px”,
背景:“黑色”,
不透明度:0.4
}).parent().append(“”).find(“.modal”).css({
宽度:“200px”,
高度:“80px”,
位置:“固定”,
左:“50%”,
顶部:“50%”,
marginLeft:“-100px”,
marginTop:“-55px”,
背景:“白色”,
填充:“5px10px”,
borderTop:“20px纯色钢蓝色”
}).text(按下了this.id+).parent()
.附件(“正文”)
。单击(函数(){
$(this.remove();
}).hide(0)、fadeIn(100);
});

请原谅这个丑陋的密码。。。这只是为了证明一点,是的,上课会更好P

它可以是简单的,也可以是复杂的。您甚至可以动态地构建元素

$(“输入”)。单击(函数(){
$(“”).css({
}).html(“”.find(“div”).css({
位置:“固定”,
宽度:“100%”,
高度:“100%”,
左:“0px”,
顶部:“0px”,
背景:“黑色”,
不透明度:0.4
}).parent().append(“”).find(“.modal”).css({
宽度:“200px”,
高度:“80px”,
位置:“固定”,
左:“50%”,
顶部:“50%”,
marginLeft:“-100px”,
marginTop:“-55px”,
背景:“白色”,
填充:“5px10px”,
borderTop:“20px纯色钢蓝色”
}).text(按下了this.id+).parent()
.附件(“正文”)
。单击(函数(){
$(this.remove();
}).hide(0)、fadeIn(100);
});

请原谅这个丑陋的密码。。。这只是为了证明一点,是的,上课会更好P

嗨,约瑟夫,谢谢你的回答,我想知道我是否想根据你的代码在模式框上附加一个按钮,如何做,你能在上面的代码上给我看一下吗,非常感谢。嗨,约瑟夫,谢谢你的回答,我想知道我是否想根据你的代码在模式框上附加一个按钮,如何做,你能给我看看上面的代码吗,非常感谢。