如何防止Jqtouch自动滚动到当前类的div?

发布于 2024-09-13 05:50:05 字数 767 浏览 1 评论 0原文

我正在使用 Jqtouch 设计 iPhone 应用程序。

由于我在顶部使用标准标题/工具栏,因此我只想将其固定在那里而不移动。我发现了如何通过创建一个带有类工具栏的 div 并将 CSS 显示设置为 block 并将 min-height 设置为 0px 来实现这一点。

但是,当它启动时,每次我更改页面时(从技术上讲,它会显示不同的 div,而不是显示(?)),它会自动滚动到刚刚更改为的 div 的顶部,我需要向上滚动才能看到工具栏(工具栏位于最顶部,div 上方)。

如何让它实际上滚动到工具栏或页面顶部?

这是我当前代码的简化布局:(对于正文部分)

<body>
<div id="toolbar" class="toolbar" style="display: block; min-height: 0px !important;">
<h1>Header</h1>
<a class="button" href="#">Button</a>
</div>

<div id="home" class="current">
<!--Content in here-->
<a href="#test" class="slideup">Link to next page</a>
</div>

<div id="next">
<!--Content in here-->
</div>
</body>

I'm using Jqtouch to design a iphone app.

As I'm using a standard header/toolbar at the top, I want to simply have it fixed there without moving. I found out how to do this by creating a div with class toolbar and setting CSS display to block and min-height to 0px with important.

However, when it starts up and every time I change pages (technically, it's making different divs display and not display(?)), it autoscrolls to the top of the div that it just changed to, and I need to scroll up to see the toolbar (the toolbar is at the very top, above the div).

How do I make it actually scroll up to the toolbar or top of the page?

Here's a simplified layout of my current code: (For body section)

<body>
<div id="toolbar" class="toolbar" style="display: block; min-height: 0px !important;">
<h1>Header</h1>
<a class="button" href="#">Button</a>
</div>

<div id="home" class="current">
<!--Content in here-->
<a href="#test" class="slideup">Link to next page</a>
</div>

<div id="next">
<!--Content in here-->
</div>
</body>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

但可醉心 2024-09-20 05:50:05

我不完全确定我收到了你的问题,但听起来你想要一个具有“固定”位置的元素。如果是这种情况,您可能需要尝试我针对此问题发布的解决方案

I am not entirely sure I got your question, but It sounds like you want to have an element with "fixed" position. If that's the case, you may want to try the solution I posted for this question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文