2012-06-21 43 views

回答

0

要從另一個元素的點擊事件中顯示一個面板,您需要:創建面板,使其隱藏(使用visible: false),然後使用點擊事件處理程序將其隱藏(),然後使用show()。這裏有一個例子:

var panel = new Y.Panel({ 
    bodyContent: 'foo', 
    centered: true, 
    width: 200, 
    height: 100, 
    visible: false //render the panel, but keep it hidden 
}); 
panel.render(); 

// show the panel with a click 
Y.one('#foo').on('click', function() { 
    panel.show(); 
});