Контекстное меню
Контекстое меню это выпадающий список действий возможный для определенных объектов, при нажатии на них правой кнопки.
Собственно, мы сталкиваемся с ним каждый день и это самый что не на есть привычный элемент любого интерфейса, так почему бы не включать его на свои веб-проекты?
На самом деле это делается очень легко.
А делать мы это будем с помощью плагина к jQuery, с говорящим названием «ContextMenu», который позволяет отображать меню для отдельных элементов сайта и самое главное привязывать к элементам меню нужные действия.
Сперва создадим само меню и вставим его в любое место страницы:
<div class="contextMenu" id="myMenu1">
<ul>
<li id="open"><img src="folder.png" /> Open</li>
<li id="email"><img src="email.png" /> Email</li>
<li id="save"><img src="disk.png" /> Save</li>
<li id="close"><img src="cross.png" /> Close</li>
</ul>
</div>
Как вы могли заметить, код меню — чистый html, то есть меню на 100% изменяемо и стилизируемо.
Теперь применим jQuery к нашему контекстному меню.
$('.demo1').contextMenu('myMenu1', {
bindings: {
'open': function(t) {
alert('Trigger was '+t.id+'\nAction was Open');
},
'email': function(t) {
alert('Trigger was '+t.id+'\nAction was Email');
},
'save': function(t) {
alert('Trigger was '+t.id+'\nAction was Save');
},
'close': function(t) {
alert('Trigger was '+t.id+'\nAction was Delete');
}
}
});
Этот код прикрепит контекстное меню к блоку с классом demo1 и определит действия каждого из элементов(срабатывания alert'a).
Мне кажется, что даже человек не особо разбирающийся в программирование уже понял насколько просто это работает.
Ссылки на примеры работы и сайт этого плагина даны ниже. До новых встреч! ;-)

Supports:
Firefox 1.5+
Internet Explorer 6.0+
safary 3.1
opera 9.1 не работает
как заставить работать в Опере ?
А смысл? Сделать стилизированое под дизайн своего сайта? Так весь функционал им не заменишь… Разве что при разработке цмс можно где-то запихнуть.
Я как раз про эти случаи и говорил.
Safari 3.1.2 – не работает.
Согласен с Zodios, но все же очень полезно и может пригодится.
Safari 3.1.2 работает, только если после ПКМ нажать ЛКМ сразу. Вообще плохой пример.
IE 6.0 – не работает :(
в Опере впринципе контекстное меню не работает
В Опере есть настройка — «позволить контролировать правую кнопку мыши». Если ее включить, то меню появляется, но оперовское меню все равно появляется тоже. Поверх.
Хм..странная штука. Ни в ие6, ни в опере не работает. Нафик оно надо.
Господа, ну что возмущаться.
Каков процент пользователей использует те перечисленные браузеры, где не работает?
А, кто написал, что в IE6 не работает? У меня вроде все в порядке.
???
Под оперу не полноценно работает. Я как раз над этим сейчас бъюсь, как сделаю – выложу.
btw. ты в конкурсе поучаствовать не хочешь? про 7 блогов
я ничё не понял
Спасибо за менюшку, очень красивая.
Отписалиб хоть куда второй блок кода пихать? ни так ни сяк не робит даже в ФИРЕФОХЕ
i cant get how you may share like this incredible posts admin very much thanks
oh my god terrific article admin will check out your weblog at all times
you are truly quantity a person admin your running a blog is incredible i constantly check out your website i am certain you will be the top
Fantastic submit admin! i bookmarked your web blog. i’ll appear ahead when you will have an e-mail variety including.
i cant get how you are able to reveal like this incredible posts admin very much thanks
i bookmarked you in my browser admin thank you a lot i might be in search of your next posts
I used to be searching for this good sharing admin much thanks and also have good running a blog bye
you might be genuinely number one admin your blogging is incredible i constantly verify your website i’m positive you will likely be the perfect
Excellent submit admin! i bookmarked your world-wide-web website. i will seem forward should you may have an e-mail listing including.
I used to be curious about your following post admin actually essential this blog super incredible weblog
Greetings thanks for fantastic article i was seeking for this situation very last a couple of days and nights. I’ll look for next valuable posts. Have fun admin.
you’re seriously number one particular admin your running a blog is remarkable i at all times check your web site i’m confident you might be the perfect
you will be definitely variety 1 admin your running a blog is incredible i usually test your blog i am positive you will be the most effective
Seriously necessary article admin good one particular i bookmarked your website page see you in upcoming blog publish.
you might be genuinely range 1 admin your running a blog is incredible i always test your blog site i am sure you will likely be the very best
Good a single web site owner achievements blog site submit great sharings in such a weblog always have entertaining
I was curious about your upcoming publish admin definitely wanted this blog site super amazing web site
I used to be in search of this blog survive 3 nights fantastic website operator excellent posts all the things is fantastic
I used to be searching for this blog very last three times fantastic weblog manager great posts every little thing is terrific
Amazing post admin thank you. I observed what i used to be seeking here. I will review overall of posts with this day
Excellent publish admin! i bookmarked your world-wide-web blog site. i will search forward if you may have an e-mail record adding.
Hello admin excellent post a lot thanks beloved this webpage definitely significantly
Truly needed post admin fantastic a single i bookmarked your world-wide-web web page see you in subsequent website post.
Really required post admin fantastic a single i bookmarked your world-wide-web web page see you in future webpage article.
i cant get how you’ll be able to share like this astounding posts admin very much thanks
oh my god great put up admin will examine your web site continually
I necessary for this website put up admin actually thanks i’ll search your future sharings i bookmarked your website
i cant get how you’ll be able to reveal like this remarkable posts admin considerably thanks
An unputdownable discussion is worth scuttlebutt. I guess that you should create more on this content, it mightiness not be a sacred soul but mostly group are not sufficiency to verbalise on much topics. To the next. Cheers like your КонтекÑтное меню | Чернев.ру.
I appreciate a tremendous publish, would examine one’s others topics. thanks for your thinking for this, I really felt somewhat thump by this post. Many thanks again! You earn an excellent aspect. Has fantastic info here. I do think that in case more people thought about it like this, they’d have got a better time period obtain the grasp ofing the issue.
i bookmarked you in my browser admin thank you a lot i will likely be in search of your future posts
you will be really amount one admin your running a blog is astounding i at all times check your web site i’m certain you will be the perfect
i cant get how it is possible to reveal like this remarkable posts admin much thanks
Fantastic put up admin! i bookmarked your word wide web weblog. i’ll glance ahead when you could have an e-mail variety including.