Drag to Share

Drag to Share

We’ve all seen the brilliant functionality on Mashable where news stories and interesting articles can be shared to social networking sites; the functionality is driven by the images accompanying the articles; you click and hold on an image and can then drag it into a toolbar to share it. It’s brilliant and intuitive, and in this article I’m going to show you how we can replicate this behavior with jQuery and jQuery UI.


The following screenshot shows what we’ll have at the end of the tutorial:

Final Product

Getting Started

The latest version of jQuery comes with jQuery UI and in this example we only need the core, draggable and droppable components, so make sure only these are selected in the download builder. Once the jQuery UI archive has been downloaded, unpack the js folder from the archive (we don’t need the development bundle or CSS framework in this example) in a working folder.

Now let’s create a basic page, with some text and an image on it, to showcase the behaviour; create the following new page in your code editor:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Drag to Share Example</title>
    <link rel="stylesheet" type="text/css" href="dragToShare.css">
  </head>
  <body>
    <div id="content">
      <p>Lorem ipsum dolor...</p>
      <img src="rover.png" alt="Mars Rover">
      <p>Lorem ipsum dolor...</p>
    </div>
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
  </body>
</html>

Save this as dragToShare.html in the folder with the js folder in it. Here we’ve added our layout/example text and an image, both within a container. We’re linking to the jQuery and jQuery UI source files at the bottom of the <body> and a custom style sheet in the <head>. We don’t need many styles at this point as there isn’t much on the page to actually style, but let’s add it next anyway with some basic styles for the page elements in it; in a new file in your code editor add the following:

#content { width:440px; }
#content img { float:right; margin-left:20px; }

Save this tiny file as dragToShare.css in the same folder as our HTML page. Don’t worry, we’ll be adding some more styles to the style sheet very shortly. Our example page should look like this at this point:

Example 2

Making the Image Draggable

We need to make the image draggable, which we can do with jQuery UI, add the following <script> element after the others:

<script type="text/javascript">
  $(function() {
	    
    var images = $("#content img"),
      title = $("title").text() || document.title;
		
    //make images draggable
    images.draggable();
  });
</script>

That’s all we need to do! We just cache the selector for the element(s) that we’d like to make draggable, and call the draggable() method on the resulting collection of elements. Now by clicking and holding the mouse button, the image in our example can be dragged around the page. The image will be made draggable as soon as the document is loaded as our code is wrapped in the $(function(){}) shortcut.

As well as caching the selector that returns our images, we’re also caching a selector that stores the title of the page. IE returns an empty string when using jQuery to retrieve the page title so we revert to document.title in this case.

We still have a lot to do before we’re done though; what we need to do first is to let the visitor know that dragging the image does something. Firstly we can use a little CSS to set the ‘move’ mouse pointer when we hover over the image; add the following line to the end of dragToShare.css:

.ui-draggable { cursor:move; }

We’re targeting the class .ui-draggable which is added by jQuery UI with this style so that the image will only inherit the move cursor if the image is made draggable, which won’t happen if JavaScript is switched off or otherwise unavailable. Using the class name instead of the :hover pseudo class is also much better for cross-browser compatibility.

Information Overlay

Example 3

To really make it obvious that dragging the image does something, we can also add a tooltip to explicitly tell the visitor what to do; after the draggable() method add the following new code:

var createTip = function(e) {
  //create tool tip if it doesn't exist
  ($("#tip").length === 0) ? $("<div>").html("<span>Drag this image to share the page<\/span><span class='arrow'><\/span>").attr("id", "tip").css({ left:e.pageX + 30, top:e.pageY - 16 }).appendTo("body").fadeIn(2000) : null;
};

images.bind("mouseenter", createTip);
		  		
images.mousemove(function(e) {
		
  //move tooltip
  $("#tip").css({ left:e.pageX + 30, top:e.pageY - 16 });
});
	  
images.mouseleave(function() {
		
  //remove tooltip
  $("#tip").remove();
});

We’ve basically added three new event handlers to our code; the first event handler is the createTip function, which is defined as a variable and passed to jQuery’s bind() method along with the string mouseenter specifying the event. The next two functions are anonymous and are passed inline to jQuery’s mousemove() and mouseleave() helper methods.

In the createTip function we first check whether the tooltip already exists by seeing if a selector for it has a length of 0. If it does (have a length of 0) we know it doesn’t exist and can then create it. We set the innerHTML of the tooltip so that it features a span containing the message to the visitor, and a second empty span which we’ll use for a little decoration when we add the additional CSS in a moment.

We give the tooltip an id so that we can select it efficiently later on and set its CSS left and top properties using the pageX and pageY properties from the event object (e) which is passed to our function automatically. We then append the tooltip to the body of the page and fade it in slowly. To avoid HTML errors, we need to escape the forward-slashes in the raw HTML we add to the tooltip.

The mousemove function is used to make the tooltip track with the pointer, so when the pointer moves, the tooltip moves with it. We use the css method again as well as the pageX and pageY properties. Finally, the mouseleave function simply removes the tooltip from the page.

Styling the Tooltip

Example 4

Now we can add some CSS for our tooltip; in the interests of progressive enhancement we’ll use the sexy CSS3 rgba style to make out tooltip semi-transparent in capable browsers; at the bottom of dragToShare.css add the following new selectors and rules:

#tip {
  position:absolute; display:none; height:25px; padding:9px 9px 0px;
  color:#fff; font-family:Verdana, Arial, Helvetica, sans-serif;
  font-size:11px; font-weight:bold; border-radius:4px;
  -moz-border-radius:4px; -webkit-border-radius:4px;
  background:#000; background:rgba(0,0,0,.5); 
}
#tip .arrow {
  width:0; height:0; line-height:0; border-right:8px solid #000;
  border-right:8px solid rgba(0,0,0,.5); border-top:8px solid transparent;
  border-bottom:8px solid transparent; position:absolute; left:-8px;
  top:9px;
}

That’s all we need. Most of the styles are pretty basic but we use the border-radius styles to give the tooltip rounded corners in gecko and webkit browsers, and as I mentioned before we use rgba to make the tooltip semi-transparent. This is a great effect and while it’s only supported in a few of the common browsers, it’s much more efficient than using an alpha-transparent PNG.

The empty span that we added to the tooltip is styled so that it looks like a speech-bubble arrow pointing to the mouse pointer. This is created using the CSS-shapes technique and as it’s not CSS3 it’s supported in most browsers. It’s even supported in IE6, although the border transparency that we give it isn’t supported. We could fix this easily enough if we really wanted to, but for the purposes of this tutorial I’m not going to deviate to this topic.

Note that we also use rgba for the border-color of our span so that it blends in with the rest of the tooltip. Now, IE (any version) is not going to support these rgba styles, but as we have provided normal colors before the rgba declarations, in both the tip and the span, the tooltip will just appear solid black in IE. Here’s how our tooltip will appear at its best, beautiful isn’t it?

Example 5

Adding the Drop Targets

Ok, so our visitors now know that they can drag the image somewhere in order to share the page, but where do they drag it to? And where can they share it? We now need to react to the image being dragged and show the drop targets, which will consist of a series of links to social networking sites. We’ve several things we need to do here; we need to add an overlay to the page and create the drop targets first of all.

We could create the drop targets entirely from scratch, on the fly, with jQuery like we did with the tooltip, but out in the wild this would probably result in an unacceptable delay for some visitors. We can minimise this by adding the underlying mark-up for the drop targets to the page, and just showing it when we need to. Directly before the <script> elements at the bottom of the page, add the following code:

We use a simple unordered list as the container for the drop targets where each item corresponds to a single target; I’ve included the social networking sites that I have accounts for, feel free to add more if you wish. Each list item contains a link with its href set to the home page of the social networking site that it represents. We’ll need to modify these URLs later in our script, and while more information could be provided in these links, I thought it cleaner to just provide the basic URL in the mark-up.

We need to style these now as well; add the following new styles to the bottom of our style sheet:

#targets {
  display:none; list-style-type:none; position:absolute; top:10px;
  z-index:99999;
}
#targets li {
  float:left; margin-right:20px; display:block; width:60px; height:60px;
  background:url(iconSprite.png) no-repeat 0 0; position:relative;
}
#targets li#delicious { background-position:0 -60px; }
#targets li#facebook { background-position:0 -120px; }

The outer list container is initially hidden from view so that we can show it when a drag begins. We disable the default icon for list items (a small circle) and position it absolutely at the top of the page. As we want the icons to be visible above the overlay, we set a high z-index on it.

The list items are floated so that they stack up next to each other horizontally and are spaced out with a little margin. The images are set on the list items so an appropriate size is set for them. We’re using a sprite file for the images so we need to set the background position of the delicious and Facebook icons.

Note: the icons used in this example came from the Social.me icon pack by jwloh and are available from here. They aren’t visible yet, but with the CSS we just added they should look something like this:

Example 6

Wiring up the Drag Behavior

At this point, we’ve got out drop targets in place ready to be shown so we now need to set some of draggable’s configuration options in order to add the overlay and show the drop targets when a drag begins. We can also create a helper element that will be dragged instead of the underlying <img>. Change the draggable() method so that it appears as follows:

//make images draggable
images.draggable({
  //create draggable helper
  helper: function() {
    return $("<div>").attr("id", "helper").html("<span>" + title + "</span><img id='thumb' src='" + $(this).attr("src") + "'>").appendTo("body");
  },
  cursor: "pointer",
  cursorAt: { left: -10, top: 20 },
  zIndex: 99999,
  //show overlay and targets
  start: function() {
    $("<div>").attr("id", "overlay").css("opacity", 0.7).appendTo("body");
	$("#tip").remove();
	$(this).unbind("mouseenter");
	$("#targets").css("left", ($("body").width() / 2) - $("#targets").width() / 2).slideDown();
  },
  //remove targets and overlay
  stop: function() {
    $("#targets").slideUp();
    $(".share", "#targets").remove();
    $("#overlay").remove();
    $(this).bind("mouseenter", createTip);
  }
});

We’ve added an object literal as an argument to the draggable() method containing a series of configuration options; let’s look at each option in detail:

helper

We supply an anonymous function as the value of the helper option; the function must return an element, so we create a new div element, give it an id and insert a string of raw HTML. The HTML we insert creates a new span element containing the title of the page. We also create a new image. The image will act as a thumbnail; again we give it an id for styling purposes and set its src attribute to the src of the original image.

cursor

We set the cursor option to pointer so that an action pointer is shown while the drag is in progress.

cursorAt

We use another object literal with the cursorAt option to position where on the drag helper the icon appears. We set the left and top properties of the object to the pixel values. The values we supply set the cursor so that it appears -10px to the left of the helper, and 20 pixels into it.

zIndex

We set the z-index of the helper element using the zIndex option, which sets the style directly on the element as an inline style. This forces the helper above the overlay, and is required because the overlay is inserted after the helper.

start

This option is one of the draggable component’s built-in event handlers; whenever a drag interaction starts the function we supply as a value to this option is executed. Within this function we create the overlay and append it to the page, remove the tooltip and stop the current image displaying it again, and then position the targets in the center of the viewport before showing them with a nice slideDown animation.

stop

The stop option is another of draggable’s built-in event handlers and is called when the drag stops. All we do here is tidy up, removing the overlay and any text that has been added, sliding up the targets, and rebinding the createTip function to the mouseenter event.

So with these options configured, when we begin dragging the image several things will happen; first of all the overlay will be displayed which will grey out the rest of the page. We also remove the tooltip and prevent it from displayed again if the mouse pointer enters the image again. In most browsers this isn’t a problem – the pointer isn’t considered ‘over’ the image because it’s on top of the drag helper. But IE (even version 8) does consider it over the image still and displays both the helper and the tooltip.

Our helper element, which will be dragged instead of the original image, will also be created and displayed, showing the page title as a label, and a thumbnail version of the original image. The drop targets will also be shown with a nice animation.

At this stage, we need to provide a little CSS for the helper element, thumbnail and the overlay; add the following selectors and rules to the bottom of dragToShare.css:

#overlay {
  background-color:#000; position:absolute; top:0; left:0; width:100%;
  height:100%; z-index:99997;
}
#helper {
  background-color:#c2c2c2; position:absolute; height:35px;
  padding:15px 70px 0 20px; color:#fff;
  font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:bold;
  font-size:18px; border-radius:8px; -moz-border-radius:8px;
  -webkit-border-radius:8px; border:3px solid #7d7d7d;
}
#thumb {
  width:50px; height:50px; position:absolute; right:0; top:0;
  border-left:3px solid #7d7d7d;
}

For the overlay we set the background color to solid black, but remember we use jQuery to make it transparent. It’s positioned and sized to cover the whole page and has its z-index set to just under that of the drag helper and targets.

The helper element has a range of styles set on it to make it presentable. Mostly these are simple everyday styles that don’t warrant discussion, but we do set the border-radius styles here like we did with the tooltip. The height of the helper is fixed, but its width is not, so it will grow or shrink to accommodate all of the alt text from the image that was dragged.

The thumbnail version of the original image is sized and positioned at the far right of the helper. Enough right-padding has been given to the helper element to ensure that the text doesn’t run in to the image. When a drag begins, the page should appear like this:

Example 7

Making the Targets Droppable

Our final task is to make the target social networking icons to react to having the helper element dropped on to them. We do this using the droppable component of jQuery UI, which we selected when we built our jQuery UI download.

Directly after the draggable method (containing the code we just added) add the droppable method:

//make targets droppable
$("#targets li").droppable({
  tolerance: "pointer",
  //show info when over target
  over: function() {
    $(".share", "#targets").remove();
    $("<span>").addClass("share").text("Share on " + $(this).attr("id")).addClass("active").appendTo($(this)).fadeIn();
  },
  drop: function() {
    var id = $(this).attr("id"),
      currentUrl = window.location.href,
	baseUrl = $(this).find("a").attr("href");

    if (id.indexOf("twitter") != -1) {
      window.location.href = baseUrl + "/home?status=" + title + ": " + currentUrl;
    } else if (id.indexOf("delicious") != -1) {
      window.location.href = baseUrl + "/save?url=" + currentUrl + "&title=" + title;
    } else if (id.indexOf("facebook") != -1) {
      window.location.href = baseUrl + "/sharer.php?u=" + currentUrl + "&t=" + title;
    }
  }		  
});

Again, we use several different configuration options to tailor the implementation to our needs. The options we use are listed below:

tolerance

The tolerance option is used to set when the drag helper is considered to be over a drop target. We’ve used pointer here so the mouse pointer itself must be over the drop target.

over

We use the over event callback to execute code whenever the drag helper is over a drop target; in this function we first ensure that the element we’re about to create is removed, this is to hide elements that may have been created in a previous drag. We then create a new span element and set its innerText to a message indicating which social network the icon represents.

drop

The drop event callback function is where we actually perform the sharing of the page on whichever social network the visitor dropped the drag helper on. We get the URL of the current page and the URL for the social network from the href of the link in the list item representing the icon. Each of the social networks used in this example are able to accept information via the URL, so for example with Twitter, we can add the text for a status update to the input field on the visitor’s Twitter page, making it easy for the visitor to share the page title and URL. The information to do this is passed in the URL, so starting with the baseUrl we can build the required URL and then navigate to it with the window.location.href property.

We need one line of CSS and then we’re done; to style the share message that we append to the page when the drag helper is over a drop target add the following code:

.share {
  font-weight:bold; position:absolute; font-size:14px;
  font-family:Verdana; margin-left:-38px;
}

We should now find that when we drop the drag helper onto one of the icons, the corresponding page should load with the URL of our page displayed:

Facebook Example

Summary

Final Product

Our work here is done; we can now deploy the code to our web pages to provide an easy way for our visitors to share our content across their social networks. This method is good because it’s easy to implement consisting entirely of client-side code. We don’t need to worry about authentication or anything like that – the visitor will just be prompted to enter their username and password when the external site loads up.


Tags: jQuery
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.circuitbomb.com Dustin

    Awesome Tut on how to replicate that functionality.

  • http://www.philohermans.com Philo

    Nice Outcome! :)

  • Ankit Bathija

    Simply Amazing!! Will surely implement this in my upcoming Blog!! :-P

  • http://anevid.com asf

    Simply brilliant

  • http://www.phpandstuff.com Burak

    Is there a wordpress plugin for this?

  • http://blog.nordahl.me Kenneth D. Nordahl

    Great tutorial! I were impressed by the same UI at abduzeedo.com when they released their new design a couple of weeks ago.

    • http://www.danwellman.co.uk Dan Wellman

      yeah I noticed it there just the other day :D

  • Roberto M

    This looks pretty cool, thanks for sharing, I’ve already seen it in mashable.com

    Can you give me the idea of how much should I charge for adding this functionality to a client website?

    Thanks in advance and congratulations, very nice work!

  • http://www.oraystudios.com Iqbal

    nice tutorial, i think i’m gonna try this one soon. thanks!

  • http://www.oraystudios.com Iqbal

    just remembered, this functionality at abduzeedo and mashable came with the meebo bar (the one on the bottom of the page there) you can google it up if you want to

  • http://mohdrafie.co.uk/ Rafie

    Amazingly useful! Would be appreciated if you can enlighten some of us how to enable the “send to email”?

    • http://www.danwellman.co.uk Dan Wellman

      Sending email programmatically requires acess to the backend – it can be done trivially using PHP (I have an example on my site), but I wanted to keep things so that everything is totally client-side with this tutorial so that anyone can follow the tutorial and use the resulting code :)

  • http://www.safha-solutions.com Mohammed

    Nice work … I will give it a try in my next project :)

  • http://webexpedition18.com Nikola

    This is amazing! Thanks :D

  • http://www.axomedia.ch axomedia

    Awesome article! Thank you. I’ll integrate it in one of my upcomming projects for sure…

  • http://www.danwellman.co.uk Dan Wellman

    Thanks for reading :D

  • Toms Ošiņš

    This is just great! Thank you a lot!

  • http://www.pixelbombmedia.com Andrew

    This is AMAZING! It was just a few days ago I was thinking “I really would love to implement that on my new site…” Thanks so much for the great Tut!

  • Sean Foushee

    Don’t take this the wrong way, I love the effect, however I’m at a loss as to the usefulness of this particular example. It seems to adds effort to what should be a simple point-and-click function all for the sake of utilizing effects. This reminds me of the Scriptaculous example of the drag and drop shopping cart, another neat example that does nothing but adds effort and effects over the simplified Add to Cart single click button.

    I would think a better use for such an effect would be to duplicate Coda’s drag and drop downloader on its homepage. In which you simply drag the apps icon to the download icon and voila instant dmg happiness. That example at least has the added benefit of adding additional functionality to a section of the site that doesn’t normally display download links in order to get the visitor what they want with minimal effort.

    But overall a great tutorial and as I mentioned at the top, nice effect.

    • Sean Foushee

      To clarify, I meant Panic not Coda (which is obviously a product of Panic’s).

  • http://www.what-a-geek.com Adit Gupta

    This is awesome..I was just thinking about adding this feature on my blog..and now I know how to do that!! :)

  • http://www.andrewconn.com Andrew

    It’s cool to know how to do it, but I don’t think it’s all that great. Not your tut – your tut was great… just the idea in general. I’ve played with it on Mashable and it doesn’t seem appealing to me. My opinion of course…

    • http://envexlabs.com Matt Vickers

      I have to agree with this.

      The tutorial was good, but abduzeedo uses this method and when i’m looking for design inspiration I like to be able to just drag the images onto my desktop.

      Using this method prevents me from doing that. It’s just a pain, but that’s just me. It would probably work differently with different applications.

      Great tutorial though!

    • http://hancic.info Jan Hančič

      I agree. This doesn’t seem intuitive to me at all. You are not even aware that you can share until you hover over the image. What this also means that you have to have some image in your content just to be able to share it, even if the image is redundant ….

      • http://www.danwellman.co.uk Dan Wellman

        Thanks for the comments, I appreciate all of them, it’s good to get different people’s points of view :)

        Dragging on to the desktop was certainly something that I didn’t consider when creating the tutorial, but there may be a way that another icon could be added to the targets that represents the desktop and dragging the image to that icon could bring up a ‘save file’ dialog maybe..? I don’t know, but there is sure to be a way that this behaviour can be be preserved :)

        Thanks again

    • Natrium

      I agree.

      Instead of the image, I’d make a title draggable. And you somehow will need to give the user a clue to tell him what he can do with the header.

    • http://www.ferdychristant.com Ferdy

      I too think that the claim that this is “intuitive” is false, at least for normal users. Hardly any website in the world makes use of drag and drop, therefore it is not part of conventions, not part of what users expect, and therefore not intuitive.

      The effect itself is cool, and that does look intuitive, but you will have to be absolutely, positively clear to users that an object is draggable in the first place. In addition, you will always need to provide an alternative path for users to accomplish the same thing.

      Other than that, the effect itself is great. Compliments.

      • http://listoric.deviantart.com Listoric

        I also agree, this is not intuitive at all. I’d rather prefer a small “facebook” icon next to the articles headline. It has it’s “wow” effect, definitely, but I’d rather go with a more obvious approach.

        The tutorial itself is grand. Really nice :)

      • http://www.danwellman.co.uk Dan Wellman

        Thanks for your thoughts guys, I totally see your point of view about drag and drop not being obvious to all users. Perhaps ‘intuitive’ was the wrong word to use in the intro.

        On the flip-side however, new effects and techniques will never become mainstream if no one ever implements them ;)

        I also just want to mention that I’m not completely advising on using a new technique in the article, I’m just showing people how to do something that is already being done by other (big and popular) sites out there :)

  • Ben

    Looks great. Is there a way to have this work for only certain images in a given post and disable it for others ?

    • http://www.danwellman.co.uk Dan Wellman

      Sure, just change the selector used at the start of the code section, e.g. instead of:

      var images = $(“#content img”)

      Use:

      var images = $(“#the_id_of_the_specific_image”)

      Or a class selector…

  • http://phpjquery.co.cc/phpjquery samiul jahan

    awesome

  • http://spotdex.com David Moreen

    Not enough time in the day to do stuff. I promise you though, first thing tomorrow after school. I am going to launch into this. Thank your in advanced!

  • thesowntownzone

    Cool its brilliant

  • http://www.productivedreams.com Gopal Raju

    I was waiting for this one!

  • http://www.imageeccentric.com Patrick Gilder

    Is there a Joomla plug-in for this…?

  • http://tutorialblog.info tutorial blog

    thank for post

  • Kenan

    This is tutorial!!!
    Great man and thanks ;)

  • http://www.makemycreative.in Yash Mistrey

    Great ! Very Impressing & Eye catching !

    Suggest me to work better ! on my website !

    Thanks !

  • Elie Andraos

    Great tut !! thanks !

  • fiktion

    Is anyone else having issues with viewing past tutorials, using the pagination at the bottom of the screen,or having other navigation issues with the site?

  • http://www.benblogged.com Ben Blogged

    Very well done

  • http://www.w2point.com Web 2.0 Tools

    Well done buddy, I saw drag to share first @mashable but had no idea how to do it… Thanks

  • Labec Media

    I like this. Abduzeedo (as well as many others, I’m sure) use this technology.

  • http://www.jlapitan.com jlapitan

    has anyone created a plugin for wordpress like this?

  • http://www.desktopgremlins.com David Landis

    The Mashable one has the option to drag to email too. I don’t see that option here. If I really studied this could I figure it out? Or is the drag to share EMAIL option just not going to work with this solution? This looks VERY cool and I would like to use something similar on my papercraft site.

    • http://www.danwellman.co.uk Dan Wellman

      You may be able to find a web-based email app that accepts data via URL, but really, to add email support you would need to use some PHP on your server to send the mail. That said, sending email with PHP is very easy and takes just a few lines of code (and the PEAR extension).

      For this tutorial however, I wanted to keep it all client-side, which is why the email (or IM) options are not included :)

  • http://www.ourstime.com shankar

    this is very nice

  • http://hamdentool.com/ Hamdent

    Falun Gong is very good.

  • http://www.danielwhyte.com Daniel Whyte

    This tech is so annoying grrr, i am constantly dragging images in posts to folders on my computer for future refrence, now i have to right click then middle click open in new window, there should be an option to tun this off on sites.

  • http://www.l4u.dk/ Kasper

    Awesome functionality, thanks for sharing

  • http://spotdex.com David Moreen

    Dan I noticed that when I was done with the tutorial the “Share on [network]” text did not function correctly. I check out the demos source code and, you just forgot to add the #targets li span class in the tutorial.

    Very good tutorial I must say. Took me 1 1/2 hours to do, but I had fun..

    • http://www.danwellman.co.uk Dan Wellman

      Thanks for spotting that David, I changed this at the last minute and must have forgotten to update the article ><

  • http://www.elmastudio.de Manu

    It’s really cool, thx :) Saw it just 5minutes ago somewhere and was wondering about it :)

  • http://www.smashingshare.com/ Waheed Akhtar

    Nice tutorial. But feel like it is not easy to drag and drop at specific place for sharing.
    Just a thought, it could be more usable if we right click and share it.
    Thanks

  • http://neilhoja.com neilhoja

    can i use it for blogspot?

  • Mark Kadlec

    Killer stuff Dan, thanks for sharing. I agree with the other posts as far as the usefulness of this particular example, but at least this gives us the concept of how we can apply it to different scenarios.

    Great work!

    • ipsj

      Please reply to my query .I am waiting for solution to above question :(

  • http://www.philipstel.co.nr phil

    cool result!

  • http://www.geniuzdesigns.de g3niuz

    really great tutorial ….
    so nice technique … ;D

    saw it on abduzeedo i think ;D

  • ipsj

    pLEASE HELP.i have applied each and every thing to a testing blog http://testingblogpnp.blogspot.com/ .But nothing is happening .i don’t know why.i have also given the code i used there in the same blog given above ( http://testingblogpnp.blogspot.com/ ) Plz check the defect and reply to

    I deadly need this plz reply.

    Thanx…

  • ipsj

    PLEASESSSSSSSSSSS HELP SEE http://testingblogpnp.blogspot.com/ WHY ITS NOT WORKING….. :(

  • http://ipsj20@gmail.com ipsj

    YUPEEEEEEEE i have made it now it is possible to add this widget on blogger blogs

    bloggers ask for this on ipsj20@gmail.com

    and a GREAT thanks to author of cs..

  • http://www.twitter.com/syntaxterr0r SyntaxTerr0r

    This tutorial is now a WordPress plugin :
    http://wordpress.org/extend/plugins/wp-dragtoshare-extended/