Click here to Skip to main content
15,886,362 members
Articles / Web Development / ASP.NET

Create a jQuery Context Menu for Treeview

Rate me:
Please Sign up or sign in to vote.
4.63/5 (14 votes)
27 Apr 2009CPOL2 min read 131.1K   5.5K   39  
jQuery Context Menu for Treeview
/* Generic context menu styles */
.contextMenu {
	position: absolute;
	width: 120px;
	z-index: 99999;
	border: solid 1px #CCC;
	background: #EEE;
	padding: 0px;
	margin: 0px;
	display: none;
}

.contextMenu LI {
	list-style: none;
	padding: 0px;
	margin: 0px;
}

.contextMenu A {
	color: #333;
	text-decoration: none;
	display: block;
	line-height: 20px;
	height: 20px;
	background-position: 6px center;
	background-repeat: no-repeat;
	outline: none;
	padding: 1px 5px;
	padding-left: 28px;
}

.contextMenu LI.hover A {
	color: #FFF;
	background-color: #3399FF;
}

.contextMenu LI.disabled A {
	color: #AAA;
	cursor: default;
}

.contextMenu LI.hover.disabled A {
	background-color: transparent;
}

.contextMenu LI.separator {
	border-top: solid 1px #CCC;
}

/*
	Adding Icons
	
	You can add icons to the context menu by adding
	classes to the respective LI element(s)
*/

.contextMenu LI.edit A { background-image: url(images/page_white_edit.png); }
.contextMenu LI.cut A { background-image: url(images/cut.png); }
.contextMenu LI.copy A { background-image: url(images/page_white_copy.png); }
.contextMenu LI.paste A { background-image: url(images/page_white_paste.png); }
.contextMenu LI.delete A { background-image: url(images/page_white_delete.png); }
.contextMenu LI.quit A { background-image: url(images/door.png); }

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer DBA Ron Carrigan
United States United States
I enjoy the challenges of programming. I graduated from Western Kentucky University with a B.S. with a major in Computer Science in 1995. I started ASP.NET programming in 2003 using VB.NET. Now, I do most of my programming in C#.

Comments and Discussions