我从展示中遵循此示例:http : //showcase.richfaces.org/richfaces/component-sample.jsf?demo=popup&sample=login&skin=blueSky 它显示了我如何单击链接以打开 popupPanel 并附加该面板到该链接的相同位置。但我希望如果我再次单击,它将关闭面板。有人知道如何实现吗?这是我的代码
<h:outputLink value="#" id="sb-dd-ol" >
<rich:componentControl event="click" operation="show" target="sb-dd-pp">
<a4j:param noEscape="true" value="event"/>
<rich:hashParam>
<a4j:param noEscape="true" name="top"
value="jQuery(#{rich:element('sb-dd-ol')}.parentNode).offset().top +
jQuery(#{rich:element('sb-dd-ol')}.parentNode).height()" />
<a4j:param noEscape="true" name="left"
value="jQuery(#{rich:element('sb-dd-ol')}.parentNode).offset().left" />
</rich:hashParam>
</rich:componentControl>
Test
</h:outputLink>
<rich:popupPanel id="sb-dd-pp" autosized="true" modal="false"
moveable="false" resizeable="false" followByScroll="false">
This is a test
</rich:popupPanel>