Make a Div Draggable and Resizable using jQueryUI

Nishant_Mittal
Posted by Nishant_Mittal under jQuery category on | Points: 40 | Views : 2011
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DraggableAndResizable.aspx.cs"
Inherits="JQueryValidationExample.DraggableAndResizable" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>jQuery Draggabele And Resizable</title>

<link href="themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui.js" type="text/javascript"></script>
<style type="text/css">
p
{
font-weight:bold;
}
#draggableResizable
{
margin:0 auto;
width: 190px;
height: 190px;
padding: 0.5em;
}
</style>
<script type="text/javascript">
$(function () {
$("#draggableResizable").draggable();
});
</script>
<script type="text/javascript">
$(function () {
$("#draggableResizable").resizable();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="draggableResizable" class="ui-widget-content">
<p>
Drag me or Resize me</p>
</div>
</form>
</body>
</html>


In above code use jquery-ui-1.9.1.custom for jquery-ui.css and jquery-ui.js (see in head tag), this can be downloaded from http://jqueryui.com/download/.

Comments or Responses

Posted by: Rimi1289 on: 8/10/2013 Level:Starter | Status: [Member] | Points: 10
Cool. You will also love this.

http://www.encodedna.com/2013/08/draggable-resizeable-html-dom-elements-using-jquery.htm

Also, dynamically create "draggable" elements using JQuery.

Login to post response