.offset().top的位移高度是相对于body还是.leftmenu_main li???

$(".leftmenu_main li").hover(function () {

    $(this).addClass('hover');

    var menuTop = $(this).offset().top;

    

    var itemsList = $(this).children(".sec_cd");

    var itemsCount = itemsList.find('.sec_icon').length;


    itemsList.css("top", subMenuTop).fadeIn("fast");

}, function () {

    $(".sec_cd").hide();

    $(this).removeClass('hover');

});

https://img3.mukewang.com/5c0f5d4b00012a0215450397.jpg


https://img1.mukewang.com/5c0f5d5f0001f11c15480334.jpg

慕妹3146593
浏览 615回答 1
1回答

holdtom

为什么不查 API。Get the current coordinates of the first element in the set of matched elements, relative to the document.
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript