• Resolved jana26

    (@jana26)


    Hi Folks,

    i’m trying to add some animation on hovering my menu, but in the current item it should not be animated. I added this code but it doesn’t work:

    if (!$('#mainNavigation li').hasClass('current-menu-item')) {
    			$('#mainNavigation li').children('a').hover(
    				function () {
    					$(this).children('.bg_span').animate({'top': '0px'});
    				},
    				function () {
    					$(this).children('.bg_span').animate({'top': '80px'});
    				}
    			);
    		}

    If i delete the if-part it works, but for the current-item too.
    Can somebody help me, please. Everywhere i looked. they have the same code as mine.

Viewing 1 replies (of 1 total)
  • Thread Starter jana26

    (@jana26)

    Found a solution:

    $('#mainNavigation li:not(.current-menu-item)').hover(
    				function () {
    					$(this).find('.bg_span').animate({'top': '0px'});
    				},
    				function () {
    					$(this).find('.bg_span').animate({'top': '80px'});
    				}
    			);

Viewing 1 replies (of 1 total)
  • The topic ‘If does not have the class’ is closed to new replies.