Zebra Zebra - 6 months ago 25
CSS Question

Changing navbar colour in relation to it's slideDown and slideUp state

I want to give blue color to my navbar when the blue div which contains text is in slideDown state - I have it. BUT when I try to give back the background image my navbar had before when it gains slideUp state it 'ignores' me. What should I improve?


$('nav li a i:first').on({

var $d=$('.forperson1');

}else if($d.is(':hidden')){




link to my pen on Codepen

Answer Source

Here's a working CodePen:


nav.open {
  background-image: none;
  background-color: blue;


$(document).ready(function() {

$('nav li a i:first').on('click', function() {





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download