Hello all,
Hoping someone has the time to help me out with some jquery confusion?
I am trying to get the parent of an elements background change when the child is hovered and then go back to its default when the childs hover has ended.
The problem I have at the moment is with my script I cannot get the code to return the background colour to its default from the *.css file, when the hove ris lost the parents background remains the colour it was changed too.
The Jquery::
$(document).ready(function() {
$('ul.sf-menu li li li').hover(function() {
var currentID = "#";
currentID += $(this).parent().parent().attr('id');
$('ul.sf-menu li li ul').parent(currentID).css('background', 'pink');
$('ul.sf-menu li li li').focusout().css('background', '#00467F');
});
});
The HTML::
<ul class="sf-menu">
<li id='education'><a>Education</a>
<ul>
<li class='education' id='6'><a href='#' title='Desktops'>Desktops</a>
<ul>
<li class='education2'><a href='#' title='#'>#</a></li>
<li class='education2'><a href='#' title='#'>#</a></li>
<li class='education2'><a href='#' title='#'>#</a></li>
</ul>
</li>
<li class='education' id='9'><a href='#' title='#'>#</a>
<ul>
<li class='education2'><a href='#' title='#'>#</a></li>
</ul>
</li>
<li class='education' id='11'><a href='#' title='#'>#</a>
<ul>
<li class='education2'><a href='#' title='#'>#</a></li>
</ul>
</li>
<li class='education' id='14'><a href='#' title='#'>#</a>
<ul>
<li class='education2'><a href='#' title='#'>#</a></li>
<li class='education2'><a href='#' title='#'>#</a></li>
<li class='education2'><a href='#' title='#'>#</a></li>
<li class='education2'><a href='#' title='#'>#</a></li>
</ul>
</li>
</ul>
</li>
</ul>
Thank you in advance anyone that can shine a light on this problem for me.