小编Ver*_*raG的帖子

ShareThis插件无法在FancyBox标题中使用

我是所有JavaScript的新手,所以请耐心等待:)我正在尝试将ShareThis插件添加到FancyBox的标题,以便用户可以共享某个图片.它很好地显示但是当我点击"共享"按钮时没有任何反应.相同的插件在普通页面上运行得很好,所以我猜它是冲突的脚本(FancyBox脚本中的插件脚本).不幸的是,我不太了解JavaScript以便自己解决它,但我真的需要这个才能工作......

如果有人知道如何解决它,我将非常感激!以下是我到目前为止代码方面的内容:

FancyBox的脚本(包括在Fancybox标题中显示元素):

$(document).ready(function() {
$(".wrap").fancybox({
    closeClick  : false,
    nextEffect: 'fade',
    prevEffect: 'fade',
    beforeLoad: function() {
        var el, id = $(this.element).data('title-id');

        if (id) {
            el = $('#' + id);

            if (el.length) {
                this.title = el.html();
            }
        }
    },
    helpers : {
    title: {
        type: 'inside'
    }}
});

});
Run Code Online (Sandbox Code Playgroud)

这是我需要在标题中显示的内容:

<div id="title1" class="hidden">
<div class='share'>
<span class='st_facebook_hcount' displayText='Facebook'></span> 
<span class='st_twitter_hcount' displayText='Tweet'></span> 
<span class='st_pinterest_hcount' displayText='Pinterest'></span> 
<span class='st_email_hcount' displayText='Email'></span>
</div>
<p>Some description</p>
</div>
Run Code Online (Sandbox Code Playgroud)

我也从他们的网站上包含了ShareThis脚本.

有什么建议?

javascript fancybox sharethis

2
推荐指数
1
解决办法
3553
查看次数

标签 统计

fancybox ×1

javascript ×1

sharethis ×1