0

我正在使用 jdev11.1.1.6

如果我需要滚动到页面顶部..这完美..

var scrollTop = function (event) {
$('.mainWrapper,body,html').animate( {
scrollTop : 0
}, 'slow');
}

我把它从 pqr.jsff 称为

<af:commandLink text="click test" clientComponent="true" id="col7">
<af:clientListener method="scrollTop " type="click"/>
</af:commandLink>

将其定向到特定元素的链接

我修改了我的功能如下,但它对我不起作用

var scrollToSpecificPosition= function (event) {
$('.mainWrapper,body,html').animate( {
scrollTop : $("#gl1").offset().top
}, 'slow');
}

gl1 是我希望指向的 id

<af:goLink id="gl1" text="test"></af:goLink>

我把它从 pqr.jsff 称为

<af:commandLink text="click test" clientComponent="true" id="col7">
<af:clientListener method="scrollToSpecificPosition" type="click"/>
</af:commandLink>
4

1 回答 1

0

我想,问题是一个 Id 字段。
“gl1” id 是 adf 组件的正确标识符,但在 html-dom 中会有所不同,因为 adf 组件本身可能具有复杂的 html 结构,并且为了保持 id 的唯一性,adf 将为其添加父母 id 作为前缀等.
还有一件事。您必须检查clientComponent选项是否设置为“ true ”,以确保该组件在 dom 中可用。然后找到类似 FireBug real component id 的东西,

它可能看起来有点复杂,例如“pt1:pg1:gl1:link”。如果你确定你的代码总是在相同的环境中运行,你可以硬编码这个 id。另一种选择是使用掩码来查找您的组件。

您也可以尝试使用 AdfPage (native js lib) 通过它们的原始 id 访问 adf 组件(虽然它不是那么容易使用并且它也有一些限制)。

于 2013-10-17T22:54:08.040 回答