【问题标题】:Fancybox 2 hashtag linking not showing title attributeFancybox 2 主题标签链接未显示标题属性
【发布时间】:2012-10-10 08:05:56
【问题描述】:

我正在使用fancybox 2,并且我已经成功地创建了指向我的内容的哈希标记链接,但是当我单击以从例如搜索页面转到该内容时,它会显示所有fancybox 内容但不显示标题。我猜测这是因为我没有单击具有 title="" 属性的锚标记。

有没有什么方法可以在不点击锚点的情况下得到这个标题?

我的代码如下所示:

<a class="library-content-link lightbox" href="#main-document" title="Main Document"></a>

js:

var thisHash = window.location.hash;

if(window.location.hash) {
    $(thisHash).fancybox({
        width       : 640,
        height      : 380,
        fitToView   : false,
        autoSize    : false,
        closeClick  : false,
        openEffect  : 'fade',
        closeEffect : 'fade',
        openSpeed   : 300,
        closeSpeed  : 300,
    }).trigger('click');
}

$(".lightbox").fancybox({
    width       : 640,
    height      : 380,
    fitToView   : false,
    autoSize    : false,
    closeClick  : false,
    openEffect  : 'fade',
    closeEffect : 'fade',
    openSpeed   : 300,
    closeSpeed  : 300,
});

【问题讨论】:

    标签: jquery title hashtag fancybox-2


    【解决方案1】:

    你很可能(或没有)关注我的帖子https://stackoverflow.com/a/12254290/1055987

    我猜你的 html 缺少应该等于 hrefID .... 类似

    <a id="main-document" class="library-content-link lightbox" href="#main-document" title="Main Document"></a>
    

    ...所以你会将两个选择器绑定到fancybox,IDhash)和class;现在两者都具有相同的title 属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多