简体   繁体   中英

Named anchor links not working inside dojo dialog (chrome and firefox)

I have a problem with with named quick links eg

<a href="#bottom">Jump to bottom</a>
    ....load of content.....
<a name="bottom"></a>

not working correctly when inside a dojo dialog

The links do not work in firefox at all. They do work in internet explorer. They work in chrome if the parent page is scrolled to the bottom. If the parent page is not scrolled to the bottom then clicking the link in the dialog scrolls the parent page by an amount, continually clicking the link keeps scrolling the parent page until it reaches the bottom, at which point the link within the dialog works.

here is a jsfiddle .

Can anyone suggest what the issue is, or a possible solution?

Thanks in advance

It seems that Google Chrome has a problem with your anchor being the last thing on the pane. If you change your HTML to be:

<a href="#bottom">Jump to bottom</a>
....load of content.....
<a name="bottom"></a>Some random character

It works fine on Chrome (35.0.1916.153). To provide a clean solution the best thing is to add a simple space on the end of your HTML, for example:

<a href="#bottom">Jump to bottom</a>
....load of content.....
<a name="bottom"></a>&nbsp;

This seems to work just fine, as you can see in your update JSFiddle: http://jsfiddle.net/QWEzC/123/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM