jquery - CSS change element on Navbar focus -
so particular version of general problem - macstyle search can pretty nifty - it's supper annoying when combined dropdown menu - it's considered focus until drop down clicked @ point dropdown transitioned away mouse.
.mac-style { width: 100px; -webkit-transition: width 1s ease-in-out; -moz-transition:width 1s ease-in-out; -o-transition: width 1s ease-in-out; transition: width 1s ease-in-out; } .mac-style:focus{ width: 260px; }
i know can use :hover elements nearby +
or inbetween ~
, there anyway specify search bar expansion long on navbar focused? , have narrow when element somewhere on page other on navbar focused?
i don't see pure css solution work small jquery script solve it.
if apply class search field when focused , add events actions make shrink, clicking outside .navbar
, remove class.
demo
$(function () { $(".mac-style").focus(function () { $(this).addclass("active"); }); $(".not-navbar").click(function() { $(".mac-style").removeclass("active"); }); });
Comments
Post a Comment