在页面锚无法在Firefox中工作 [英] In page anchor not working in firefox

查看:80
本文介绍了在页面锚无法在Firefox中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的代码如下所示,该代码重复每一页的拍摄数量.我的目的是打开一个弹出窗口,然后直接通过url转到该特定镜头,例如

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

www.example.com/shot/#12.

由于某种原因,它在IE和chrome中可以正常工作,但在Firefox中则不能.在Firefox中,它指向的是不同的东西,但确实会打开弹出窗口.

For some reason this works fine in IE and chrome but does no in Firefox. In Firefox it gets pointed to something different but does open the popup.

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

推荐答案

锚点

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

例如:正常方式

 <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>

这样称呼:

example.com/myShot.html#ShotNumber

编辑: html5:文档中指示的部分

如果DOM中存在一个元素,该元素的 ID 与解码后的脆弱片段完全相同,则树形顺序中的第一个此类元素是文档的指示部分;在这里停止算法.

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; stop the algorithm here.

如果DOM中有一个具有 name 属性的 a 元素,该元素的值恰好等于脆弱(未解码的脆弱),则第一个这样的元素树序是文档中指示的部分;在这里停止算法.

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; stop the algorithm here.

这篇关于在页面锚无法在Firefox中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆