在这个wordpress主题中添加一个fancybox

时间:2013-09-14 15:21:27

标签: jquery wordpress fancybox

我正在建立一个新的投资组合,你可以在这里看到。 www.mikelucid.com

我的问题来了,因为标签中包含其他html,其中包括实际点击的叠加层。这使得添加花式盒子变得不可能。

是否有专家愿意快速达到峰值?

我试图像这样做,但无法让它发挥作用:/

$( document ).ready(function() {
    $("a.the_post").click(function(e) {
        var outerHTML = $("<div />").append($(this).find('.wp-post-image').clone()).html();
        console.log(outerHTML)
        $(this).fancybox({
            'content': outerHTML,
        });
        e.preventDefault();
    });
});

1 个答案:

答案 0 :(得分:0)

我不知道这是否解决了你的问题,但这段代码

$(this).fancybox({
    'content': outerHTML,
});

不触发fancybox,每次点击a.the_post

时,它只会将fancybox绑定到引用的元素

尝试这样做

$.fancybox({
    'content': outerHTML,
});