Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.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 在另一个div悬停时向下滑动div_Jquery - Fatal编程技术网

Jquery 在另一个div悬停时向下滑动div

Jquery 在另一个div悬停时向下滑动div,jquery,Jquery,我想在另一个div悬停时向下滑动第n个div。我已经创建了一个函数,但它不起作用。我想向下滑动,分别悬停父div的子div。使用此功能,悬停时不会向下滑动任何对象。请帮帮我 <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script>

我想在另一个div悬停时向下滑动第n个div。我已经创建了一个函数,但它不起作用。我想向下滑动,分别悬停父div的子div。使用此功能,悬停时不会向下滑动任何对象。请帮帮我

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("#hide").click(function(){
  myfunction();

  });

  function myfunction(index) {
    var x = [];
    $(".check").each(function() {
       x.push($(this).text());
    });
    $("#demo1").text(x[0]); // We can use x[1 or 2 or 0] in the same id to get the value.
    $("#demo2").text(x[1]);
    $("#demo3").text(x[2]);
  }
});
</script>
</head>
<body>
<div id="main">
<p class="check">If you click on the "Hide"</p>
<p class="check">button, I will disappear.</p>
<p class="check">If you click on the "Hide" button</p>
</div>
<p id="demo1">"Hide" button</p>
<p id="demo2">"Hide"</p>
<p id="demo3">button</p>
<button id="hide">Hide</button>
<button id="show">Show</button>

</body>
</html>

$(文档).ready(函数(){
$(“#隐藏”)。单击(函数(){
myfunction();
});
函数myfunction(索引){
var x=[];
$(“.check”)。每个(函数(){
x、 推送($(this.text());
});
$(“#demo1”).text(x[0]);//我们可以在同一个id中使用x[1、2或0]来获取值。
$(“#demo2”).text(x[1]);
$(“#demo3”).text(x[2]);
}
});

如果单击“隐藏”

按钮,我将消失

如果单击“隐藏”按钮

“隐藏”按钮

“隐藏”

按钮

隐藏 显示
您可以使用

var isShow=false;
$(“#切换”)。单击(函数(){
$('.check').slideToggle();
$(this).text(isShow?“隐藏”:“显示”);
isShow=!isShow;
});

如果单击“隐藏”

按钮,我将消失

如果单击“隐藏”按钮

“隐藏”按钮

“隐藏”

按钮


隐藏
你在哪里用过这种
悬停东西?我只看到一个
点击
事件。你的问题不清楚!1.
悬停点在哪里?2.您删除了一部分操作代码,即更改文本。