单击按钮时输入框切换
Input box toggle when click button
当我按下搜索按钮(红色方块)时,如何让输入框(蓝色方块)变成 visible/hidden Link Image
我试图在 CSS 中进行转换,我也在 javascript 中进行了测试,但是 JS ... 我关闭了(我知道 js 是如何工作的)
现在,我试过了!
$("#Hide").click(function() {
$(".buttontoggle").hide("blind");
});
* {
padding: 0;
margin: 0;
}
html {
background-image: url(../Images/background.jp);
background-repeat: no-repeat;
background-attachment: fixed;
font-family: 15px/1.5 'Arial', 'Helvetica', 'sans-serif', 'Montserrat';
}
body {
height: 2000px;
}
.container {
border: 2px solid;
width: 1164px;
height: 1600px;
margin: 177px 350px 0px 371px;
overflow: hidden;
background-color: #0A081E;
}
/* #region Header */
header {
background: #0A081E;
color: #ffffff;
padding-top: 0px;
min-height: 55px;
border-bottom: #e8491d 3px solid;
position: fixed;
min-width: 1920px;
top: 0px;
z-index: 1;
}
header a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 14px;
}
header li {
float: left;
display: inline;
padding: 11px 45px 0 15px;
margin-left: -30px;
}
#logo {
width: 360px;
height: 55px;
background-size: cover;
background-repeat: no-repeat;
}
header #logo {
float: left;
background-image: url(../Images/logo.png);
background-size: 280px 40px;
margin: 7px 0px -7px 40px;
}
.nav-container {
width: 1280px;
margin: auto;
overflow: hidden;
right: 10px;
}
header nav {
float: right;
margin-top: 10px;
}
header a:hover {
color: #cccccc;
}
.vl {
border-left: 2px solid white;
height: 35px;
float: left;
position: absolute;
left: 76.40%;
top: 10px;
opacity: 0.76;
border-radius: 35%;
}
.LoginButton {
margin: -11px -3px 0px 20px;
background-color: #0A081E;
/* Green */
border: none;
color: white;
padding: 10px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
cursor: pointer;
border-radius: 15%;
font-weight: bold;
}
.LoginButton:hover {
background-color: #ffffff;
}
.LoginButton:hover a {
color: black;
font-weight: bold;
}
.fa-search {
margin: -7px 0px 0px 0px;
background-color: #0A081E;
/* Green */
border: none;
color: white;
text-align: center;
padding: 5px 5px;
text-decoration: none;
display: inline-block;
font-size: 15px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 15%;
position: relative;
}
.fa-search:hover {
background-color: #ffffff;
color: black;
}
.searchbox {
border: 1px solid red;
box-sizing: border-box;
border-radius: 4px;
margin: -5px -10px 0px -5px;
padding: 0px 6px 6px 6px;
visibility: visible;
text-align: center;
}
<body>
<header>
<div class="nav-container">
<a href="Default.aspx" id="Logo">
</a>
<nav>
<ul>
<li class="buttontoggle"> <a href="#">New Release</a> </li>
<li class="buttontoggle"> <a href="#">Others</a> </li>
<li class="buttontoggle"> <a href="#">Top</a> </li>
<li class="buttontoggle"> <a href="#">Contact</a> </li>
<li>
<form>
<input type="text" class="searchbox" name="search" />
</form>
</li>
<li><i class="fa fa-search" id="Hide"></i></li>
<div class="vl"></div>
<li> <span class="LoginButton">
<a href="#" >Login</a>
</span>
</li>
</ul>
</nav>
</div>
</header>
<body>
这是我写的最后一个代码...我也尝试在 css 中使用 webkit 转换,但这不是我想要的 and
我的英文很烂,我想你不会明白我的意思
编辑:您可以尝试实时编辑它:..WebPage
您应该使用切换而不是隐藏,如下所示
$("#Hide").click(function() {
$(".searchbox").toggle("blind");
});
当然,您已经确保在 html 中包含了 jquery。如果没有,只需将此添加到您的 html 以快速测试您的工作:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
相同的字体真棒
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
当我按下搜索按钮(红色方块)时,如何让输入框(蓝色方块)变成 visible/hidden Link Image
我试图在 CSS 中进行转换,我也在 javascript 中进行了测试,但是 JS ... 我关闭了(我知道 js 是如何工作的)
现在,我试过了!
$("#Hide").click(function() {
$(".buttontoggle").hide("blind");
});
* {
padding: 0;
margin: 0;
}
html {
background-image: url(../Images/background.jp);
background-repeat: no-repeat;
background-attachment: fixed;
font-family: 15px/1.5 'Arial', 'Helvetica', 'sans-serif', 'Montserrat';
}
body {
height: 2000px;
}
.container {
border: 2px solid;
width: 1164px;
height: 1600px;
margin: 177px 350px 0px 371px;
overflow: hidden;
background-color: #0A081E;
}
/* #region Header */
header {
background: #0A081E;
color: #ffffff;
padding-top: 0px;
min-height: 55px;
border-bottom: #e8491d 3px solid;
position: fixed;
min-width: 1920px;
top: 0px;
z-index: 1;
}
header a {
color: #ffffff;
text-decoration: none;
text-transform: uppercase;
font-size: 14px;
}
header li {
float: left;
display: inline;
padding: 11px 45px 0 15px;
margin-left: -30px;
}
#logo {
width: 360px;
height: 55px;
background-size: cover;
background-repeat: no-repeat;
}
header #logo {
float: left;
background-image: url(../Images/logo.png);
background-size: 280px 40px;
margin: 7px 0px -7px 40px;
}
.nav-container {
width: 1280px;
margin: auto;
overflow: hidden;
right: 10px;
}
header nav {
float: right;
margin-top: 10px;
}
header a:hover {
color: #cccccc;
}
.vl {
border-left: 2px solid white;
height: 35px;
float: left;
position: absolute;
left: 76.40%;
top: 10px;
opacity: 0.76;
border-radius: 35%;
}
.LoginButton {
margin: -11px -3px 0px 20px;
background-color: #0A081E;
/* Green */
border: none;
color: white;
padding: 10px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
cursor: pointer;
border-radius: 15%;
font-weight: bold;
}
.LoginButton:hover {
background-color: #ffffff;
}
.LoginButton:hover a {
color: black;
font-weight: bold;
}
.fa-search {
margin: -7px 0px 0px 0px;
background-color: #0A081E;
/* Green */
border: none;
color: white;
text-align: center;
padding: 5px 5px;
text-decoration: none;
display: inline-block;
font-size: 15px;
transition-duration: 0.4s;
cursor: pointer;
border-radius: 15%;
position: relative;
}
.fa-search:hover {
background-color: #ffffff;
color: black;
}
.searchbox {
border: 1px solid red;
box-sizing: border-box;
border-radius: 4px;
margin: -5px -10px 0px -5px;
padding: 0px 6px 6px 6px;
visibility: visible;
text-align: center;
}
<body>
<header>
<div class="nav-container">
<a href="Default.aspx" id="Logo">
</a>
<nav>
<ul>
<li class="buttontoggle"> <a href="#">New Release</a> </li>
<li class="buttontoggle"> <a href="#">Others</a> </li>
<li class="buttontoggle"> <a href="#">Top</a> </li>
<li class="buttontoggle"> <a href="#">Contact</a> </li>
<li>
<form>
<input type="text" class="searchbox" name="search" />
</form>
</li>
<li><i class="fa fa-search" id="Hide"></i></li>
<div class="vl"></div>
<li> <span class="LoginButton">
<a href="#" >Login</a>
</span>
</li>
</ul>
</nav>
</div>
</header>
<body>
这是我写的最后一个代码...我也尝试在 css 中使用 webkit 转换,但这不是我想要的
我的英文很烂,我想你不会明白我的意思
编辑:您可以尝试实时编辑它:..WebPage
您应该使用切换而不是隐藏,如下所示
$("#Hide").click(function() {
$(".searchbox").toggle("blind");
});
当然,您已经确保在 html 中包含了 jquery。如果没有,只需将此添加到您的 html 以快速测试您的工作:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
相同的字体真棒
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">