如何避免iframe中的锚点滚动父页面 [英] How to avoid anchors in iframes to scroll parent page
问题描述
下面是一个示例: http://jsfiddle.net/ymbV7/1/
不要向下滚动页面,但滚动iframe直到看到Contents菜单,然后尝试任何链接(例如Features)。
我需要外部页面不滚动,而iframe必须正确地滚动到被点击的锚点。
有什么想法?
所以你说的是,当你点击描述链接细节的链接时,你想要移动到一个特定的段落?
根据我的理解你可以这样做。
< a href =#exactline>点击此处< / a>
而不是点击这里您可以编写Features,就像我在 http://jsfiddle.net/ymbV7/1/
现在链接到它应该移动的地方,所有你需要做的就是这样:
< h2>< a name = exactline>直接从功能链接< / a>< / h2>
< p>要覆盖此行为,可以使用某些标准技术。特别是,您需要在要链接的位置的文本正文中创建指定的锚点。
< / p>
exactline是指向段落或标题的链接名称。
它只滚动iframe,而不是整个页面。
引用此链接以获得更多通关
http ://www.thesitewizard.com/html-tutorial/link-to-specific-line-or-paragraph.shtml
我试过了,它工作正常对我来说
So, here's the problem: I have a quite long page with an iframe in the middle. Now, if an anchor is clicked in the iframe, the entire page is scrolled to the iframe, which is what I want to avoid.
Here's an example: http://jsfiddle.net/ymbV7/1/ Don't scroll down the page, but scroll the iframe until you can see the "Contents" menu, and try any of the links (for example "Features").
I need the external page not to scroll, while the iframe has to correctly scroll to the clicked anchor.
Any ideas?
So you are telling that you want to move to a particular paragraph when clicked on the link which describes the link detail right?
According to what I understand you can do like this.
<a href="#exactline">Click here</a>
Instead of Click here you can write Features, as of what I saw in http://jsfiddle.net/ymbV7/1/
now to link to the place where it should move all you need to do is this:
<h2><a name="exactline">Linking Directly from Features</a></h2>
<p>To override this behaviour, certain standard techniques can be used. In particular, you will need to create named anchors in the body of the text at the point where you want to link to.
</p>
"exactline" is the link name given to the para or heading you what to refer.
It scrolls only the iframe and not the whole Page..
refer this link for more clearance
http://www.thesitewizard.com/html-tutorial/link-to-specific-line-or-paragraph.shtml
I tried and it worked for me
这篇关于如何避免iframe中的锚点滚动父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!