I try to make the body on focus in the input field dark and set the opacity to 6. It works great so far. But I want that the input field does not look like the whole body - and that doesn't work.
I want that the input field on focus is bright and all the rest is dark.
Here's my code:
HTML
<b:navBar position="top" sticky="true" fluid="false" brand="bIg">
<b:navbarLinks pull="left">
<h:form styleClass="navbar-form navbar-left">
<b:inputText placeholder="Suchbegriff" styleClass="inputNavbar"></b:inputText>
<b:commandButton look="default" value="suchen" styleClass="btnSearch"></b:commandButton>
</h:form>
</b:navbarLinks>
<b:navbarLinks pull="right">
<b:dropMenu value="" iconAwesome="fa-user">
<b:navLink value="Profil bearbeiten"></b:navLink>
<b:navLink></b:navLink>
<b:navLink value="Abmelden" styleClass="logoutLink"></b:navLink>
</b:dropMenu>
<b:dropMenu value="" iconAwesome="fa-wrench">
<b:navLink value="Einstellungen"></b:navLink>
</b:dropMenu>
</b:navbarLinks>
</b:navBar>
CSS
body.dark {
background-color: #333;
opacity: 0.6;
}
JS
$(function() {
$('.inputNavbar').on('focus', function() {
$('body').not(this).addClass('dark');
});
$('.inputNavbar').on('blur', function() {
$('body').not(this).removeClass('dark');
});
});