向上和向下滚动页面JavaScript导航 [英] Up and Down scroll page JavaScript navigation

查看:80
本文介绍了向上和向下滚动页面JavaScript导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在每个部分的右侧都有向上和向下的箭头,如果您点击它们,可以向上或向下滚动部分。

I have up and down arrows on the right hand side of each section where if you click them it scrolls either up or down sections.

<div class="next_section"><a id="after_contact"><img src="<?php echo get_stylesheet_directory_uri() ?>/img/arrow_top.png" width="73" height="36" alt="Prev Section"></a></div> 
<div class="next_section"><a id="after_work5"><img src="<?php echo get_stylesheet_directory_uri() ?>/img/arrow_next.png" width="73" height="36" alt="Next Section"></a></div>

问题是,并非所有箭头都可以在页面上下滚动。有些工作,有些则不。我已经完成了对每一个正确的知识,因为它是一个上方或下方的区域,但是如果你点击一些箭头,它将不会执行任何操作。

Problem is, not all of the arrows are working to scroll up and down the page. Some work, some don't. I have made the on each correct to my knowledge with it being an area above or below but if you click on some arrows, it won't do anything.

任何一个知道哪里出了问题?

Any one know what is going wrong?

网址: http:// www.londonadvertising.com/2011
Pastie链接: http://pastie.org/2913679

非常感谢

Many Thanks

推荐答案

页面导航问题是不是所有的<一个>标签id是唯一的。

The problem with the page navigation is that not all the < a > tag ids are unique.

JavaScript只找到第一个具有特定ID的元素,只有那个元素可以工作。所有其他名称为ID的人不会做任何事情。

The JavaScript is only finding the first the element with a particular ID and only that one will work. All others with the name ID after that will not do anything.

如果您检查,唯一使用的箭头是特定ID的第一次出现。

If you check, the only arrows that work are the first occurrences of a particular ID.

确保所有< a>标签下的div将类'next_section'有一个唯一的ID

Ensure that all < a > tags under a div will class 'next_section' have a unique ID

<div class="next_section first">
 <a id="after_work1"> <!-- <<<< ID must be unique -->
   <img src="something.jpg" alt="Next Section">
 </a>
</div>

这篇关于向上和向下滚动页面JavaScript导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆