关于Fancybox和PHP Mysql添加<;br/>;还是标题中的新行

关于Fancybox和PHP Mysql添加<;br/>;还是标题中的新行,php,mysql,html,fancybox,Php,Mysql,Html,Fancybox,有没有办法在标题中添加 因为我想从另一个表数据中添加一些内容 这是我的密码 title="'.$row['product_name'].'" >' ... 比如说 产品名称为“Ben What” 产品描述是“是的,来找我” 我想在标题中添加一些描述。。我不希望它在标题中被连接 我想添加换行符,但不知何故它不起作用 输出应该是 Ben What Yeah Come at me 不是 谢谢大家!!我试了很多,但都没用 看起来您在谈论HTML标记中的title属性 HTML属性不能包含H

有没有办法在标题中添加

因为我想从另一个表数据中添加一些内容

这是我的密码

 title="'.$row['product_name'].'" >' ...
比如说 产品名称为“Ben What” 产品描述是“是的,来找我”

我想在标题中添加一些描述。。我不希望它在标题中被连接 我想添加换行符,但不知何故它不起作用

输出应该是

Ben What 
Yeah Come at me
不是


谢谢大家!!我试了很多,但都没用

看起来您在谈论HTML标记中的
title
属性

HTML属性不能包含HTML本身

有些浏览器允许您使用HTML实体在其中放置换行符,但由于支持不稳定,不应该这样做



最好的方法是Fancybox描述如何对
title
属性执行各种转换。

看起来您在谈论HTML标记中的
title
属性

HTML属性不能包含HTML本身

有些浏览器允许您使用HTML实体在其中放置换行符,但由于支持不稳定,不应该这样做



最好的方法是Fancybox描述在
title
属性上执行各种转换。

我也遇到了这个问题,因此这是我的解决方案,在Fancybox的默认配置更改中:

        $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
        });
$([rel=example\u group])。fancybox({
“transitionIn”:“无”,
“transitionOut”:“无”,
“标题位置”:“结束”,
“标题格式”:函数(标题、currentArray、currentIndex、currentOpts){
返回'Image'+(currentIndex+1)+'/'+currentArray.length+(title.length?''+title:'')+'';
}
});
对于这一点:

        $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">' + title + '</span>';
            }
        });
$([rel=example\u group])。fancybox({
“transitionIn”:“无”,
“transitionOut”:“无”,
“标题位置”:“结束”,
“标题格式”:函数(标题、currentArray、currentIndex、currentOpts){
返回“”+标题+“”;
}
});
通过这种方式,您可以在fancybox标题属性中使用HTML:

<a rel="example_group" href="./example/9_b.jpg" title="Lorem <br/> ipsum dolor sit amet"><img alt="" src="./example/9_s.jpg" /></a>

请注意title属性内部的


这是您可以使用fancybox进行的配置,正如@Charles所讨论的。

我也遇到了这个问题,因此这是我的解决方案,在fancybox的默认配置更改中:

        $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
            }
        });
$([rel=example\u group])。fancybox({
“transitionIn”:“无”,
“transitionOut”:“无”,
“标题位置”:“结束”,
“标题格式”:函数(标题、currentArray、currentIndex、currentOpts){
返回'Image'+(currentIndex+1)+'/'+currentArray.length+(title.length?''+title:'')+'';
}
});
对于这一点:

        $("a[rel=example_group]").fancybox({
            'transitionIn'      : 'none',
            'transitionOut'     : 'none',
            'titlePosition'     : 'over',
            'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                return '<span id="fancybox-title-over">' + title + '</span>';
            }
        });
$([rel=example\u group])。fancybox({
“transitionIn”:“无”,
“transitionOut”:“无”,
“标题位置”:“结束”,
“标题格式”:函数(标题、currentArray、currentIndex、currentOpts){
返回“”+标题+“”;
}
});
通过这种方式,您可以在fancybox标题属性中使用HTML:

<a rel="example_group" href="./example/9_b.jpg" title="Lorem <br/> ipsum dolor sit amet"><img alt="" src="./example/9_s.jpg" /></a>

请注意title属性内部的


这是@Charles谈到的fancybox的配置。

使用

你可以使用
废话废话废话,这样我就解决了我的问题。

使用

你可以使用
废话废话废话,这样我就解决了我的问题。

我想他指的是Fancybox中的标题,它是
标记IIRC上的标题属性。如果没有一些繁重的转义,你仍然无法将HTML放入属性中,我不确定Fancybox是否足够聪明,可以自行撤销。我是说Fancybox中的标题是否有可能在标题中使用
??正如我在回答中所述,你不能在标题中添加
br
标记,事情不是这样的。您可以使用
titleFormat
回调函数提供一个函数,以任意方式格式化标题,包括将非HTML的内容更改为HTML。不幸的是,除了在谷歌上发现的东西,我对Fancybox一无所知。你需要阅读他们的文档以了解更多信息。我想他指的是Fancybox中的标题,它是
标记IIRC上的标题属性。如果没有一些重载转义,你仍然无法将HTML放入属性中,我不确定Fancybox是否足够聪明,可以自行撤销。我是说Fancybox中的标题是否有可能在标题中使用
??正如我在回答中所述,你不能在标题中添加
br
标记,事情不是这样的。您可以使用
titleFormat
回调函数提供一个函数,以任意方式格式化标题,包括将非HTML的内容更改为HTML。不幸的是,除了在谷歌上发现的东西,我对Fancybox一无所知。你需要阅读他们的文档以获取更多信息。不幸的是,当我将鼠标悬停在img上时,我不知道如何在预览中隐藏此语法,我看到
诸如此类诸如此类
不幸的是,当我将鼠标悬停在img上时,我不知道如何在预览中隐藏此语法,我看到
诸如此类诸如此类