Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Jquery simple context menu using DIV and UL

Posted on 2013-01-24
2
Medium Priority
?
465 Views
Last Modified: 2013-01-26
I am not able to figure out how to build this pop-up type menu for actions link (picture attahced), for each row of the table. It is like a little context menu. I have the link and ul inside TD, but not able to figure out the Jquery and Styles. How do I accomplish this?
<tr>
                       
<td style="width: 140px; text-align: right;padding-right: 20px">

<a href="javascript:void(0)" onclick="showActions();">Actions</a>
<div class="size">

 <ul class="list">
 <li>Link1</li>
 <li>Link2</li>                                    
</ul>

</div>

</td>

</tr>
Untitled-2.png
0
Comment
Question by:immtrac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 600 total points
ID: 38816718
here's a start:

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta charset="UTF-8">
        <style>
            table{
                width:80%;
            }

            .data-tr{
                background-color:lightblue;
                padding:20px;

            }
            ul, ul li{
                list-style: none;
                margin:0;
                padding:0;

            }
            .list{
                display:none;
                position:absolute;
                right:0;
                background-color:orangered;
                padding:10px;
                min-width:100px;
            }
            .size{
                position:relative;
                float:right;
            }
        </style>
    </head>
    <body>
        <table>
            <tr class="actions-tr">

                <td>
                    <div class="size">
                        <a href="#" class="actions">Actions</a>
                        <ul class="list">
                            <li>Link1</li>
                            <li>Link2</li>                                    
                        </ul>
                    </div>

                </td>

            </tr>
            <tr class="data-tr">
                <td>
                    data
                </td>
            </tr>
        </table>
        <script src="http://code.jquery.com/jquery-1.9.0.js"></script>
        <script>
            $(".actions").click(function(){
                $(this).parents(".size").find(".list").toggle();
            });
            
        </script>
    </body>
</html>

Open in new window

0
 

Author Closing Comment

by:immtrac
ID: 38822454
Thanks. It gives me something to start with.

Though I accepted the question, can you help my figure out how to hide links list after mouse is out for 2 seconds?
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question