开发者

jquery UI simple context menu, callable from button

I'm looking for some combination of a plugin or clever programming technique that will allow me to have a context-style menu in jQuery but rather than actually triggering it from a right-click, I'd like to be able to have it triggered from a button that can potentially move to different locations on my window. I can handle the part of the button itself moving without much trouble. My requirements are:

  • It should be compatible with jQuery UI 1.8 and my custom themeroller-generated theme
  • It needs to be relocatable
  • I either need to have it execute a callback when an element is selected, or have it honor the href on any a tags that make up the menu elements

I looked at Selectmenu and it's close, but it seems to want to always show the currently selected item, which is not quite what I want. Also I had to hack around it in an ugly way to make it relocate properly.

This blog post is also pretty close but the jsEvent.clientX and jsEvent.clientY don't put the dialog in the right place and I'm a little stuck as to what to do about that. Also I don't really want the options to be buttons. The menu-ish plugins have them looking right.

This plugin here is pretty much exactly what I want (I'd have to add the bit about the button, but it doesn't 开发者_StackOverflow社区look too hard). But that requires jQuery UI 1.9.

Any thoughts? It may be that this is just such a rare requirement that I have to roll my own, but somehow that seems surprising and I feel like I might be missing something.


I like this plugin. It seems that is more compatible than jQueryUI-contextmenu. Is a fork of jQueryUI-contextmenu actually jQuery-contextMenu

I liked it because it has more examples, and it says that only use one footprint in memory so it consume less resources in comparison to others. Works with +jquery 1.6 and don't necessarily need html markup,


The menu plugin you mentioned last seems to work fine with jQuery UI 1.8.x, but not jQuery UI 1.7.x.

  • jQ-UI 1.8.7: http://jsfiddle.net/william/xxGUW/
  • jQ-UI 1.8.9: http://jsfiddle.net/william/xxGUW/1/
  • jQ-UI 1.8.14: http://jsfiddle.net/william/xxGUW/2/
  • jQ-UI 1.7.2 (broken): http://jsfiddle.net/william/xxGUW/3/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜