毎日1つのjqueryプラグイン-水の1日レイアウト
水の日のレイアウト
以前に基本的なレイアウトを取得した後、私はかなり素晴らしいと感じましたが、今ではまったく使用していないことがわかりました。たとえば、jqueryでの制御方法を制御するために多くの時間を費やしました。実際、それは単なるCSSレイアウトの正しい方法を選択することの問題今日、非常に単純なレイアウトに注意してください
効果は以下の通りです
コード部分
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>水一天布局</title>
<script src="js/jquery-3.4.1.min.js"></script>
<style>
* {
margin: 0px;
padding: 0px;
user-select: none;
}
html,
body {
width: 100%;
height: 100%;
}
body {
position: relative;
}
.flexcc{
display: flex;
justify-content: center;
align-items: center;
transition: all 0.5s linear;
}
#head {
position: absolute;
top: 0px;
width: 100%;
height: 60px;
border-bottom: 1px solid lightgray;
}
#left {
position: absolute;
top: 60px;
left: 0px;
bottom: 0px;
width: 200px;
border-right: 1px solid lightgray;
}
#right {
position: absolute;
top: 60px;
bottom: 0px;
left: 200px;
right: 0px;
border-left: 1px solid red;
}
#left.check{
width: 20px;
}
#right.check{
left: 20px;
}
</style>
</head>
<body>
<div id="head" class="flexcc">头部</div>
<div id="left" class="flexcc">左边</div>
<div id="right" class="flexcc">右边</div>
</body>
</html>
<script>
$("#head").click(function(){
$("#left,#right").toggleClass("check")
})
</script>
わからない