[英]Using html in Magnific pop up title attribute
我需要将我的title属性的某些位包装在html标签中,以便在单击元素并将其弹出在Magnific Popup上时为其设置样式。 我现在正在尝试类似波纹管的东西:
<a href="path/to/img" title='<span class="date">2016 -</span> Title text goes here'> Content goes here </a>
但是,如果我像上面那样在title属性中添加html标签,则将鼠标悬停在具有title属性的元素(例如下面)时,它们将显示html标签和标题文本:
<span class="date">2016 -</span> Title text goes here
我该如何实现这一点,以便我仍然可以设置日期的样式并在没有html标记的情况下呈现日期,例如:
2016 - Title text goes here
我建议您在初始化代码中使用javascript做类似的事情:
titleSrc: function() {
return "<span class='date'>2016 -</span> Title text goes here";
}
如文档中所述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.