Fancybox Caption不适用于包含&符号的超链接

问题描述

| 我正在使用最新的Fancybox 1.3.4和最新的jQuery 1.6.1,并且在标题中也使用了超链接,例如:
<a 
  href=\"pathtoimage.jpg\" 
  title=\"Some text and a hyperlink: &lt;a href=&quot;http://www.someclient.com&quot;&gt;LINKTEXT&lt;/a&gt;\">
    <img src=\"pathtoimage.jpg\" alt=\"alt text of image\" />
</a>
但是,如果目标URL包含多个参数,则以下操作无效:
title=\"Some text and a hyperlink: &lt;a  href=&quot;http://www.someclient.com?a=1&amp;b=2&quot;&gt;LINKTEXT&lt;/a&gt;\">
如何正确编码
?a=1&b=2
以便Fancybox不会损坏? 谢谢! Chrome控制台中的Javascript错误:
Uncaught Error: INVALID_STATE_ERR: DOM Exception 11
f.extend.cleanjquery-1.6.1.min.js:18
f.buildFragmentjquery-1.6.1.min.js:17
f.fn.extend.domManipjquery-1.6.1.min.js:17
f.fn.extend.appendjquery-1.6.1.min.js:17
f.fn.extend.htmljquery-1.6.1.min.js:17
Qjquery.fancybox-1.3.4.pack.js:27
I.v.onload
    

解决方法

这有效:请参见http://wichry.net/page/test.html上的示例 码:
<a href=\"images/slimak.png\" title=\"Some text and a hyperlink: &lt;a  href=&quot;http://www.someclient.com?a=1&amp;b=2&quot;&gt;LINKTEXT&lt;/a&gt;\">
  <img src=\"images/slimak.png\" alt=\"alt text of image\" /> 
</a> 
    

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...