ShareThis plugin not working in FancyBox title

后端 未结 2 1017
一生所求
一生所求 2020-12-04 00:25

I am rather new to all things JavaScript so please bear with me :) I am trying to add ShareThis plugin to the title of FancyBox so that users can share a certain picture. It

2条回答
  •  Happy的楠姐
    2020-12-04 00:59

    I'm guessing that it's not working for this reason.

    You are loading the fancy box code when the document is ready using $(document).ready (which is fine). The code that initializes the sharethis elements has probably already run (it's unclear from your code example when you're loading it). So when you create a new set of sharethis elements using $(document).ready, they are not getting processed by the sharethis code.

    Try this:

    $(document).ready(function() {
        $(".wrap").fancybox({
            ## no change to your code above ##
        });
        // put your publisher code in below
        stLight.options({publisher:'12345'});
    });
    

提交回复
热议问题