jquery滑动选项卡的“副作用”

发布于 2024-08-23 06:46:57 字数 230 浏览 2 评论 0原文

我对此页面进行编码,一个具有滑动功能的选项卡:此处 我真的很喜欢这种效果,但是当您查看一个长选项卡(比方说规范)时,我们转到一个小选项卡(下载),然后重新单击一个大选项卡,迫使用户再次向下滚动...

是否可以使用jquery某些东西告诉页面在按下选项卡后保持最大程度地向下滚动?

I code this page, a tab with sliding capability : here
I really like the effect, but when you vien a long tab (let say specification), and we go to a smalll one (download) reclicking on a large one force the user to scroll down again...

Is it possible to jquery something that tell the page to stay scroll down at the max after the tab pressed ?

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

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

发布评论

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

评论(3

七秒鱼° 2024-08-30 06:46:57

我正在使用 jQuery UI 选项卡执行类似的操作,您可以将其修改为任何布局:

//Tab panel height matching
$(".ui-tabs-panel").each(function() {
if ($(this).height() + 30 > $(this).parents(".subTabsC").height()) {
  $(this).parents(".subTabsC").height($(this).height() + 30);
}
});

我将整个选项卡内容包装在

中。在我的例子中,30 像素是为了考虑选项卡和边框,根据需要进行调整。

I'm doing something like this with the jQuery UI tabs, you can modify it for whatever layout:

//Tab panel height matching
$(".ui-tabs-panel").each(function() {
if ($(this).height() + 30 > $(this).parents(".subTabsC").height()) {
  $(this).parents(".subTabsC").height($(this).height() + 30);
}
});

I have the whole tab content wrapped in a <div class="subTabsC">. The 30 pixels in my case is to account for the tabs and the border, adjust to whatever you need.

长不大的小祸害 2024-08-30 06:46:57

是的。 OnLoad 您可以遍历所有选项卡,找到最高的选项卡并将容器的高度设置为该值,然后删除进行平滑调整大小的任何内容。

这意味着一些较小的东西可能看起来有点丢失,但你不会调整页面大小(这也让我烦恼)。

Yes. OnLoad you could iterate through all the tabs, find the tallest and set the container's height to that value and remove whatever's doing the smooth resizing.

It means some of the smaller things might look a little lost, but you'd not be resizing the page (which annoys me too).

满意归宿 2024-08-30 06:46:57

你不能在函数末尾添加“return false”吗?这将阻止它在您单击锚链接时“刷新”页面......我可能是错的......我刚刚开始学习 jquery 和 javascript。

couldn't you just add "return false" at the end of your function? this would prevent it from "refreshing" the page when you click the anchor link....I could be wrong...I'm just starting to learn jquery and javascript.

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