Skip to content

Instantly share code, notes, and snippets.

Created June 28, 2013 20:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
<!DOCTYPE html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>SignalR - Mover Forma</title>
width: 50px;
height: 50px;
background-color: black;
cursor: move;
border-radius: 50%;
<div id="forma"></div>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script src="/signalr/hubs"></script>
$(function () {
var hub = $.connection.formaHub,
$forma = $('#forma');
hub.client.moverForma = function (x, y) {
$forma.css({ left: x, top: y });
$.connection.hub.start().done(function () {
drag: function () {
hub.server.moverForma(this.offsetLeft, this.offsetTop || 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment