如何使用HTML 5向下滚动到同一页面中的特定页面位置? [英] how to scroll down to a specific page position within same page using HTML 5 ?
问题描述
name属性在HTML 5中进行了描述所以当用户点击菜单列表项时,如何使用功能滚动到同一网页中的特定段落: -
说我有如下图所示的菜单导航栏(片段):
"name" attribute is depricated in HTML 5 So how can i consume functionality scroll to specific Paragraph within the same webpage when user click on menu list items :-
say i have menu nav bar like as shown below(snippet):
<ul>
<li href="AboutUs.aspx#Pro">Profile</li>
<li href="AboutUs.aspx#Why>Why Us</li>
<li href="AboutUs.aspx#Org>Organization</li>
<li href="AboutUs.aspx#His>History</li>
</ul>
个人资料的段落,为什么选择我们,组织,历史记录在同一网页上这里关于我们:关于: -
Paragraphs of Profile,Why Us , Organizations,History are on the same web page here AboutUs.aspx like:-
<h1><a name="Pro">Profile</a></h1>
<p>Description about Profile</p>
<h1><a name="Why">Why Us</a></h1>
<p>Description about Why Us</p>
<h1><a name="Org">Organization</a></h1>
<p>Description about Organization</p>
<h1><a name="His">History</a></h1>
<p>Description about History</p>
我通过使用上面编写的代码来使用命名锚/书签取得了成功,但我如何在HTML 5中做同样的事情用于滚动到同一页面内的目标段落。问题是NA我不支持HTML 5 !!!
如需进一步了解我所说的话,请点击以下链接:
http://www.thesitewizard.com/html-tutorial/link- to-specific-line-or-paragraph.shtml#howtostart [ ^ ]
任何帮助???
I got success on using named anchor /bookmarks by implimenting the code Written above but HOW CAN I DO THE SAME IN HTML 5 for scrolling to target paragraphs within same page.THE PROBLEM IS THAT NAME ATTRIBUTE IS NOT SUPPORTED IN HTML 5 !!!
For further understanding what i am saying click the link provided below:
http://www.thesitewizard.com/html-tutorial/link-to-specific-line-or-paragraph.shtml#howtostart[^]
Any help ???
推荐答案
我放了一堆换行符,这样你就可以看到它的工作原理。你的版本很接近,但你就是这样做的。
I put a bunch of line breaks in so you can see it work. You were close with your version, but this is how you do it.
<ul>
<a href="#Pro"><li>Profile</li></a>
<a href="#Why"><li>Why Us</li></a>
<a href="#Org"><li>Organization</li></a>
<a href="#His"><li>History</li></a>
</ul>
<h1 id="Pro">Profile</h1>
<p>Description about Profile</p>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<h1 id="Why">Why Us</h1>
<p>Description about Why Us</p>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<h1 id="Org">Organization</h1>
<p>Description about Organization</p>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<h1 id="His">History</h1>
<p>Description about History</p>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
这篇关于如何使用HTML 5向下滚动到同一页面中的特定页面位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!