gpt4 book ai didi

jquery - 将鼠标悬停在 DIV 上以展开宽度

转载 作者:技术小花猫 更新时间:2023-10-29 12:08:58 27 4
gpt4 key购买 nike

这是我目前所拥有的 - https://jsfiddle.net/8216Lntb/

body {
background-color: black;
margin: 0 auto;
height: 100%;
width: 100%;
}
.grow {
height: 100vw;
/* Origional height */
width: 25%;
/* Origional width */
margin: 0px 0 0px 0;
/* Just for presentation (Not required) */
float: left;
/* Just for presentation (Not required) */
position: relative;
/* Just for presentation (Not required) */
transition: height 0.5s;
/* Animation time */
-webkit-transition: height 0.5s;
/* For Safari */
}
.grow:hover {
width: 25%;
/* This is the height on hover */
}
<html>

<head>
<title>HOMEPAGE</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css" media="screen,projection" />
</head>

<body>
<div class="grow" style="background-color:#2A75A9;"></div>
<div class="grow" style="background-color:#274257;"></div>
<div class="grow" style="background-color:#644436;"></div>
<div class="grow" style="background-color:#8F6048;"></div>
<!--<div class="grow" style="background-color:red;"></div>-->
</body>

</html>

我想要实现的是这个 https://artsandculture.withgoogle.com/en-us/national-parks-service/parks

每次我将鼠标悬停在一个 div 上时,它都会从页面上删除一个,因为它已经超过 100%。

我的问题是我该怎么做才能让一个 div 展开时其他的 div 变小,所以它们都停留在一页上

最佳答案

I think that you don't need javascript for this.

html,body{
margin: 0 auto;
height: 100%;
width: 100%;
}
body {
background-color: black;
}
#growContainer{
display: table;
width:100%;
height:100%;
}
.grow{
display: table-cell;
height:100%;
width: 25%;
-webkit-transition:width 500ms;
-moz-transition:width 500ms;
transition:width 500ms;
}
#growContainer:hover .grow{
width:20%;
}
#growContainer:hover .grow:hover {
width:40%;
}
<div id="growContainer">
<div class="grow" style="background-color:#2A75A9;"></div>
<div class="grow" style="background-color:#274257;"></div>
<div class="grow" style="background-color:#644436;"></div>
<div class="grow" style="background-color:#8F6048;"></div>
</div>

关于jquery - 将鼠标悬停在 DIV 上以展开宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39348378/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com