Solved

Jquery simple context menu using DIV and UL

Posted on 2013-01-24
2
451 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
2 Comments
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 150 total points
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now