Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript can anybody help me about JQuery MagicLine Navigation to dropdown menu Re: can anybody help me about JQuery MagicLine Navigation to dropdown menu

#68395

this is my code, can anybody fix it ?

$(function(){

var $el, leftPos, newWidth,
$mainNav = $("#example-one"),
$mainNav2 = $("#example-two");

/*
EXAMPLE ONE
*/
$mainNav.append("
  • ");

    var $magicLine = $("#magic-line");

    $magicLine
    .width($(".current_page_item").width())
    .css("left", $(".current_page_item a").position().left)
    .data("origLeft", $magicLine.position().left)
    .data("origWidth", $magicLine.width());

    $("ul.group li").find("a").hover(function() {
    $("ul.group li:has(ul)");
    $("ul.group li ul").css('visibility', 'visible');
    $el = $(this);
    leftPos = $el.position().left;
    newWidth = $el.parent().width();
    $magicLine.stop().animate({
    left: leftPos,
    width: newWidth,
    });
    }, function() {
    $("ul.group li:has(ul)"),
    $("ul.group li ul")).css('visibility', 'hidden');

    $magicLine.stop().animate({
    left: $magicLine.data("origLeft"),
    width: $magicLine.data("origWidth")
    });
    })