Alpha 1.0 - Menu with image (not toolbar) - Ext JS

I am using Alpha 1.0 menu API to build the menu which is similar to yahoo menu YUI example, http://developer.yahoo.com/yui/examp...pwithanim.html

I checked the example coming with the alpha package and it has only toolbar example. My requirement is the initial parent menu is an image and mouse over that image will render the child menu. Please help me achieve this.

Thanks,
Thameem
Reply With Quote
  #2  
Old 02-23-2007, 05:21 AM
Default

this should do it:

var menu = new Ext.menu.Menu({shadow: false});
	menu.add(
		{id:"opt1", text: 'option1'},
		{id:"opt2", text: 'option2'}
	);
	Ext.get('test').on('mouseover', function() {
		menu.show(Ext.get('test'), "tl-bl")
	});
Having this image tag:

[img]/path/to/image.gif[/img]
Reply With Quote
  #3  
Old 02-23-2007, 05:35 AM
Default

Thanks for the suggestion. But I don't think this is the clear way to do it. Because when I mouse over the image it pops up the menu. But when I mouse out the menu stays there. If I add event handler for 'mouse out' its not even popping up the menu. And moreover the menu is appearing below the image. So, there might be a good way of doing this.

Jack, You can shed some light on this.

Thanks,
Thameem
Reply With Quote
  #4  
Old 02-23-2007, 06:21 AM
Default

The menu follows the windows-logic. When a menu is activated you can only deactivate it by clicking outside the menu.

The problem with the mouseout event is that you will trigger it as soon as you leave the image (and enter the menu).
Reply With Quote
  #5  
Old 02-23-2007, 06:27 AM
Default

The default logic as mnugter said is to hide on mousedown somewhere. If you need other logic it is definitely possible but you would have to add it. I can help, if you have questions.

Also, the second param 'tl-bl?' is an alignTo alignment option. Take a look at Ext.Element.alignTo which has great documentation on the format for these alignment options.
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值