获取元素坐标给另一个div

2019-08-12  本文已影响0人  追风筝的一朵云

//悬停出现对应下拉

    $(function(){

        $(".ivu-dropdown").mousemove(function(){

            var index_num =$(".ivu-dropdown").index(this);

            $('.ivu-select-dropdown').css('position', 'absolute');

            $('.ivu-select-dropdown').css('top', $('.ivu-dropdown').eq(index_num).offset().top + 20);

            console.log(index_num)

            $('.ivu-select-dropdown').css('left',$('.ivu-dropdown').eq(index_num).offset().left - 20);

            $('.ivu-select-dropdown').css('will-change','top');

            $('.ivu-select-dropdown').show();

            $('.ivu-select-dropdown').hover(function(){

                $(this).show()

            },function(){

                $(this).hide();

            })

        })

        $(".ivu-dropdown").mouseleave(function(){

            $('.ivu-select-dropdown').hide();

        })

    })

上一篇 下一篇

猜你喜欢

热点阅读