我正在使用一个jQuery选项卡插件,它使用锚点来定义默认打开的选项卡。但是,如果界面在屏幕下方,它不会滚动到视图中。我尝试在界面上方添加锚点标记,但我无法使其突出显示适当的选项卡并滚动到视图中。由于我不能使用两个锚点,我的想法是如果我想提供一个链接来滚动到视图中,我可以在URL中包含一个参数,例如:
http://stage.ravencreative.com/scroll/Index.html?scrollto=Interface#parentHorizontalTab2
(其中“Interface”可能是界面顶部的锚点或ID名称)
我在谷歌和stackoverflow上搜索了一下,但找不到任何东西。是否有某种脚本可以让这个工作?或者有更好的方法吗?
这里有一个可用的示例:
http://stage.ravencreative.com/scroll/Index.html
这会使第二个选项卡处于活动状态:
http://stage.ravencreative.com/scroll/Index.html#parentHorizontalTab2
(#parentHorizontalTab2 是默认打开第二个选项卡的原因)
这会滚动到选项卡界面: http://stage.ravencreative.com/scroll/Index.html#Interface (#Interface 是界面开头的锚点)
但是我无法同时让两者起作用。 有什么建议吗? 是否有一种方式可以执行以下操作: http://stage.ravencreative.com/scroll/Index.html?scrollto=Interface#parentHorizontalTab2其中脚本会检测 scrollto 参数并将其滚动到该位置?
类似于(我使用英语,因为我不熟悉代码结构):
这会滚动到选项卡界面: http://stage.ravencreative.com/scroll/Index.html#Interface (#Interface 是界面开头的锚点)
但是我无法同时让两者起作用。 有什么建议吗? 是否有一种方式可以执行以下操作: http://stage.ravencreative.com/scroll/Index.html?scrollto=Interface#parentHorizontalTab2其中脚本会检测 scrollto 参数并将其滚动到该位置?
类似于(我使用英语,因为我不熟悉代码结构):
if scrollto is found in the URL
then scroll to the anchor defined in the scrollto