如何避免iframe中的锚点滚动父页面

Ste*_*noP 15 html anchor iframe

所以,问题出在这里:我有一个很长的页面,中间有一个iframe.现在,如果在iframe中单击一个锚点,整个页面将滚动到iframe,这是我想要避免的.

这是一个例子:http://jsfiddle.net/ymbV7/1/ 不要向下滚动页面,而是滚动iframe直到你可以看到"内容"菜单,并尝试任何链接(例如"功能") ).

我需要外部页面不滚动,而iframe必须正确滚动到单击的锚点.

有任何想法吗?

Dun*_*ynh 0

尝试将您的内容放入这样的表格中:

<table cellpadding=0 cellspacing=0 height="100%" width="100%">
  <tr>
    <td> 
      Header
    </td>
  </tr>

  <tr>
    <td>
      <iframe src="http://en.wikipedia.org/wiki/jQuery" height=600 width="90%"></iframe>
    </td>
  </tr>
  <tr>
    <td> 
      Footer
    </td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

参考http://www.webdeveloper.com/forum/showthread.php?t=212032