JSFiddle - React, Tailwind, and code Playground
by Lindsey Suarez
HTML
<div id="wpadminbar">
<div class="quicklinks">
<ul>
<li> Admin Bar links go here... </li>
</ul>
</div>
<div id="adminbarsearch-wrap">
<form action="http://myurl.com" method="get" id="adminbarsearch" name="adminbarsearch">
<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />
<input type="submit" class="adminbar-button" value="Search" />
</form>
</div>
</div>
<a id="hide-admin">Hide</a>
CSS
#wpadminbar {
position: fixed;
top: 0;
height: 41px;
width: 100%;
background: #dddddd;
}
.quicklinks ul {
list-style:none;
margin:0;
padding:0;
text-align:center;
display: inline;
float:left;
}
.quicklinks ul li {
display: inline;
}
.quicklinks ul li a {
display:inline-block;
padding:0 10px;
text-decoration: none;
font-weight: 700;
color: #fff;
line-height: 41px;
font-family: "Helvetica", Arial, sans-serif;
font-size: 12px;
text-shadow: 1px 1px 0 #111;
}
#adminbarsearch {
width: 250px;
height: 41px;
float:right;
right: 10px;
top: 10px;
}
#hide-admin {
display: block;
position: fixed;
right: 10px;
top: 51px;
font: bold 11px Helvetica, Arial, sans-serif;
color: #fff;
background: #C91D07;
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
padding: 6px 10px;
cursor: pointer;
}
#hide-admin.hidden {
top: 10px !important;
}
JavaScript
$('a#hide-admin').click(function () {
var that = this;
var options = {
top: ($(this).is(":contains(Hide)") ? "-" : "+") + "=" + $('#wpadminbar').height()
};
$('#wpadminbar').add(this).animate(options, 1000, function () {
if (this == that) {
$(this).html($(this).is(":contains(Hide)") ? "Show" : "Hide");
}
});
});