dongyuhui0418 2013-06-27 23:44
浏览 106
已采纳

如何在锚点上显示弹出菜单

I am making a fairly complex front page that in essence is a threaded discussion forum. At present all is functional but I want to replace the links after the message that allow one to delete, reply, archive and other functions. At present the links are all text. I can use small images and make them look nicer. However on a busy front page with lots of messages and threads a whole bunch of images will make the whole page look overwhelming.

The way it works for now is each iteration of the call to function that reads a message from db will start a ul and this allows me to nicely pad the child messages and the depth.

Here is what I want to do - create a small popup menu that will show up when someone hovers over the actual message. Because my current way of showing threaded messages using ul and li when I tried to use jqueryui menu widget it wrecks the formatting.

Sorry about all the rambling but is there a way to show a slim line of links above a message when someone hovers over it and each message in the page will obviously need to have different links [to allow blah.php?messageid=...].

I have been looking at jqueryui and learnt it to a tiny extent and still reading the tutorial. Is there a way of doing what I asked above!

Thanks

  • 写回答

2条回答 默认 最新

  • dousi1994 2013-06-28 00:13
    关注

    a simple way to do this is as follows:

    given markup

    <div class="menu-pop">
        <div class="menu-label">Menu Label</div>
        <div class="menu-items">
            <div class="menu-item">menu choice</div>
            <div class="menu-item">menu choice</div>
            <div class="menu-item">menu choice</div>
            <div class="menu-item">menu choice</div>
            <div class="menu-item">menu choice</div>
        </div>
    </div>
    

    provide css:

    .menu-pop {
        position: relative;
    }
    
    .menu-pop .menu-items {
        display: none;
        position: absolute;
    }
    
    .menu-pop.dropped .menu-items {
        display:inherit;
    }
    

    and a simple jquery function:

    $(".menu-pop").hover(
            function() { $(this).addClass("dropped"); }, 
            function() { $(this).removeClass("dropped" ); }
        );
    

    then ... well ... make it pretty.

    see the jsfiddle here: http://jsfiddle.net/DomDay/rmSHc/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化