我的网站上有一个具有不同高度的手风琴。有些比屏幕大 - 当我点击下一个标签时,spry内容区域会扩展,但只显示spry内容区域窗口最末端的内容。
解释:
|[tab 1 .... ]|<hidden area
| content 1 |<hidden area
| content 1 |<hidden area
------------------------
| content 1 |<visible area
| content 1 |<visible area
| content 1 |<visible area
| content 1 |<visible area
| content 1 |<visible area
| content 1 |<visible area
|[tab 2 .... ]|<visible area
------------------------
| content 2 |<hidden area
| content 2 |<hidden area
当我点击标签2时会发生这种情况
|[tab 2 .... ]|<hidden area
| content 2 |<hidden area
| content 2 |<hidden area
------------------------
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
|[tab 3 .... ]|<visible area
------------------------
| content 3 |<hidden area
| content 3 |<hidden area
当我点击任何标签
时,这就是我想要发生的事情 ------------------------
|[tab 2 .... ]|<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
| content 2 |<visible area
------------------------
| content 2 |<hidden area
| content 2 |<hidden area
|[tab 3 .... ]|<hidden area
| content 3 |<hidden area
| content 3 |<hidden area
当我点击任何标签时,我希望页面自行重新定位,以便标签标题转到浏览器的最顶层,我该怎么做?
我希望这个问题有道理,因为我认真思考它不想失去任何代表!
答案 0 :(得分:0)
这是<head>
:
<script type="text/javascript">
function goToAnchor(anchor) {
location.href = "#"+anchor;
}
function spryTabAnchor(anchor)
{
setTimeout("goToAnchor('"+anchor+"')", 500); //The 500 milliseconds is a delay so you still have the animation.
}
</script>
这是锚:
<div class="AccordionPanelTab" onclick="spryTabAnchor('pan2')"<a id="pan2"></a>Tab</div>