gpt4 book ai didi

jquery mobile pageshow事件想要为特定页面工作

转载 作者:行者123 更新时间:2023-12-01 01:07:53 24 4
gpt4 key购买 nike

我在我的应用程序中使用 jquery mobile。我希望页面加载或调用时自动向下滚动。但我的问题是我想要这个特定页面。我使用下面给出的代码

 $('div').live('pageshow',function(event, ui){
goto_bottom();
});

函数 goto_bottom();用于向下滚动页面。它适用于该页面,但也适用于其他页面。这是我不想要的。有没有办法检测页面 url 并使用该条件调用它。

提前致谢。

最佳答案

您可以使用页面的 id 而不是 div 作为选择器。当您使用“div”选择器时,您将回调绑定(bind)到应用程序中所有页面的 pageshow 事件

 $('#your-page').on('pageshow',function(event, ui){
goto_bottom();
});

关于jquery mobile pageshow事件想要为特定页面工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17834456/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com