简体   繁体   English

在页面锚无法在Firefox中工作

[英]In page anchor not working in firefox

I have got my code something like below which repeats to the number of shots varying for every page. 我得到了类似下面的代码,重复了每页的拍摄数量。 My aim is to open a popup and go to that particular shot straight by url like 我的目的是打开一个弹出窗口,然后直接通过url转到该特定镜头

www.example.com/shot/#12 . www.example.com/shot/#12

For some reason this works fine in IE and chrome but does no in Firefox. 由于某种原因,这在IE和chrome中可以正常工作,但在Firefox中则不能。 In Firefox it gets pointed to something different but does open the popup. 在Firefox中,它指向的是其他内容,但确实会打开弹出窗口。

<repeater>
    <div>
        <div>
            <a href="#ShotNumber" name="#12">
            </a>
        </div>
        <div>
            HTML FOR EACH SHOT
        <div>
    <div>
<repeater>

ANCHOR

<a name="Anchorname"></a>

for example: normal way 例如:正常方式

 <div>
   <a href="#ShotNumber">Go to ShotNumber</a> <!-- Link to ShotNumber -->
   <a href="#12">Go to 12</a> <!-- Link to 12-->
 </div>
 <!-- more stuff -->
 <div>
   <a name="ShotNumber"></a> <!-- Anchor name=ShotNumber -->
   HTML FOR ShotNumber
 </div>
 <!-- more stuff -->
 <div>
   <a name="12"></a> <!-- Anchor name=12 -->
   HTML FOR 12
 </div>

Call it like: 像这样称呼它:

example.com/myShot.html#ShotNumber

EDIT: html5: the-indicated-part-of-the-document 编辑: html5:文档的指示部分

If there is an element in the DOM that has an ID exactly equal to decoded fragid, then the first such element in tree order is the indicated part of the document; 如果DOM中有一个元素的ID恰好等于解码的脆弱元素,则树形顺序中的第一个此类元素是文档的指示部分; stop the algorithm here. 在此处停止算法。

If there is an a element in the DOM that has a name attribute whose value is exactly equal to fragid (not decoded fragid), then the first such element in tree order is the indicated part of the document; 如果有一个是在具有名称属性,其值正好等于fragid(未解码fragid)DOM 中的元素,然后在树顺序中的第一元件,例如是在文档的所指示的部分; stop the algorithm here. 在此处停止算法。

Try <a name="12">This is item number 12</a> 尝试<a name="12">This is item number 12</a>

and then <a href="#12">Go to item number 12</a> . 然后<a href="#12">Go to item number 12</a>

Also, the anchor id thing is not supported in HTML5, they say. 他们还说,HTML5不支持anchor id。 This might be of interest . 这可能很有趣

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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