0

次のコードは、h:commandButton のすぐ下に垂直方向に配置された rich:popupPanel を開きます。

<h:commandButton value="Open popup" id="openBtn">
    <rich:componentControl event="click" target="myPopup"
        operation="show">
        <a4j:param name="event" value="event" noEscape="true" />
        <rich:hashParam>
            <a4j:param noEscape="true" name="top"
                value="jQuery(#{rich:element('openBtn')}.parentNode).offset().top  + jQuery(#{rich:element('openBtn')}.parentNode).height()" />
            <a4j:param noEscape="true" name="left"
                value="jQuery(#{rich:element('openBtn')}.parentNode).offset().left" />
        </rich:hashParam>
    </rich:componentControl>
</h:commandButton>
<rich:popupPanel id="myPopup" modal="false" autosized="true" resizeable="false" .... 

ユーザーが<h:commandButton>. 手伝ってくれませんか?

ありがとう

4

1 に答える 1

1

多分あなたはこれを試してみるべきです:

<a4j:param noEscape="true" name="top"
value="jQuery(#{rich:element('openBtn')}.parentNode).offset().top  + jQuery(#{rich:element('openBtn')}.parentNode).height() - $(window).scrollTop()" />

これは、要素の位置からスクロール バーの垂直位置を引いた値を "top" の値に設定します。

jQuery scrollTop()

于 2013-05-30T10:45:12.507 に答える