| Page 1 of 1 | [ 7 posts ] |
Khoa Bui
|
I want to utilize the Overlay widget to implement an search option panel that:
- When user click on a button, a panel displayed with various options. User select some options. - Then click a search icon, the option panel is hidden. Or user click elsewhere, the option panel is also hidden. That is to say, the panel is hidden when lost focus. How can i receive the event that panel lost focus? trying a 'blur' event on the Overlay but no help. Thanks. |
|
You can use the overlay-extras module which supports hiding the overlay when focus is lost or the escape key is pressed: http://yuilibrary.com/gallery/show/overlay-extras
|
Juan Ignacio DopazoYUI Contributor
|
You can also create your own Overlay class using the WidgetAutoHide extension that will do just that and add support for the Escape key.
|
Khoa Bui
|
Can you give me an example?
|
Khoa Bui
|
I create an AutohideOverlay follow your suggestion, as below:
Code: YUI.add('autohide-overlay', function(Y) { Y.AutohideOverlay = Y.Base.create("autohide-overlay", Y.Widget, [ Y.WidgetStdMod, Y.WidgetPosition, Y.WidgetAutohide, Y.WidgetStack, Y.WidgetPositionAlign, Y.WidgetPositionConstrain ]); }, 'iss-1.0' ,{requires:['widget', 'widget-autohide', 'widget-stdmod', 'widget-position', 'widget-stack', 'widget-position-align', 'widget-position-constrain']}); Then use it: Code: YUI({ modules: { 'autohide-overlay': { fullpath: '{autohide_overlay_location}/autohide-overlay.js', requires: ['widget', 'widget-autohide', 'widget-stdmod', 'widget-position', 'widget-stack', 'widget-position-align', 'widget-position-constrain'] } } }).use('autohide-overlay', function (Y) { var autohideOverlay= new Y.AutohideOverlay({ srcNode: '#containerId', zIndex: 1, width: 230, visible: false, hideOn: [ {eventName: 'clickoutside'} ] }); autohideOverlay.render(); }); I have 2 problems: - Although I set visible to false, the overlay still displayed at start. - The auto hide function does not work. Click outside won't make any affect. I try the Y.Panel, which utilize 'widget-autohide' too, the result is good: Code: var autohidePanel = new Y.Panel({ srcNode:"#containerId", width:400, centered:true, visible:false, modal:true, zIndex: 1, hideOn: [ {eventName: 'clickoutside'} ] }); autohidePanel .render(); Click outside will hide the panel. Any idea? Thanks. |
Juan Ignacio DopazoYUI Contributor
|
You may have to declare a yui3-autohide-overlay-hidden class:
Code: .yui3-autohide-overlay-hidden { visibility: hidden; } |
Khoa Bui
|
It works like a charm.
Thank you. |
| Page 1 of 1 | [ 7 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group