Question

I've been working on this code to implement a clickable "Share" button for ShareThis, e.g. instead of code that will pop-up the ShareThis window when the user hovers over the button. The key to make it work is the onmouseover:false setting:

<script language="javascript" type="text/javascript">

    var object = SHARETHIS.addEntry({
        title: "<?php the_title(); ?>",
        url: "<?php the_permalink(); ?>"},
            {button:false,onmouseover:false});

    document.write('<span id="<?php the_title(); ?>"><a href="javascript:void(0);">Share</a></span>');

    var element = document.getElementById("<?php the_title(); ?>");
    object.attachButton(element);

</script>

The problem is that the onmouseover:false setting causes the close button (X) to stop working in the popup window (the various ShareThis controls all work). Is there any kind of workaround to get that functionality working again?

Was it helpful?

Solution

I've added popup:true to the property list, like this:

var object = SHARETHIS.addEntry({
    title: "<?php the_title(); ?>",
    url: "<?php the_permalink(); ?>"},
        {button:false,onmouseover:false,popup:true});

The causes the nice ShareThis popup box to appear within a completely separate window. It's not quite as elegant, but it works. I'll leave this for a couple of days, if no one else has a suggestion to re-enable the close button on the popup then I'll accept this as the answer.

OTHER TIPS

Check your code ---

var object = SHARETHIS.addEntry({
        title: "<?php the_title(); ?>",
        url: "<?php the_permalink(); ?>"},  <----
            {button:false,onmouseover:false <----
});

quotes are not balanced

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top