Implementing a clickable ShareThis button

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?

Related posts

Leave a Reply

2 comments

  1. 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.

  2. Check your code —

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

    quotes are not balanced