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条)

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况