I want an if statement with two rules, but I'm new to this and I know I'm not doing it right but I hope this gives you an idea what I want.
$('.album_tracks_light, .album_tracks_dark').mouseenter(function() {
if ($(this).hasClass('album_tracks_active')(this > span).hasClass('span-not-link'))) {
return false;
} else {
$(this).css('background','#282828');
};
});
Basically what I want is, if the two elements that I .mousenter has either the 'album_tracks_active' class or has a span tag in it with the class 'span-not-link', then I want to change the elements background that I .mousentered.
This is the html
<li class="album_tracks_dark">
<span class="span-not-link"></span>
</li>
<li class="album_tracks_light">
<span class="span-link"></span>
</li>
Use logical or operator ||
if ($(this).hasClass('album_tracks_active') || ($(this).children('span').hasClass('span-not-link')))
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators