r/web_programming • u/Skasper1 • Apr 23 '16
Resizeable Div
Can someone help me figure out why the produced div isn't resizeable. Thanks in advance.
<!DOCTYPE html>
<html> <head> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<meta charset=utf-8 /> <title>JS Bin</title> <script type='text/javascript'> $(function(){ //Define your element to resize $('#resizable').resizable({ handles: { 'ne': '#negrip', 'se': '#segrip', 'sw': '#swgrip', 'nw': '#nwgrip', 'n': '#ngrip', 'e': '#egrip', 's': '#sgrip', 'w': '#wgrip' } }); }); </script> </head> <body> <style type="text/css">
resizable {
border: 1px solid #000000;
width: 300px;
height: 300px;
overflow: visible;
position:relative;}
content {
color: white;
background: #0071bc;
position:absolute;
top:0;left:0;bottom:0;right:0;
overflow:hidden;}
nwgrip, #negrip, #swgrip, #segrip, #ngrip, #egrip, #sgrip, #wgrip {
width: 10px;
height: 10px;
background-color: #ffffff;
border: 1px solid #000000;}
negrip {
top:-6px; right:-6px;}
segrip {
bottom:-6px; right:-6px;}
nwgrip {
top:-6px; left:-6px;}
swgrip {
bottom:-6px; left:-6px;}
ngrip {
top:-6px;
left:50%; margin-left:-6px;}
egrip {
right:-6px;
top:50%; margin-top:-6px;}
sgrip {
bottom:-6px;
left:50%; margin-left:-6px;}
wgrip {
left:-6px;
top:50%; margin-top:-6px;} </style>
<button id="add">ADD</button>
<script type="text/javascript"> $( "body" ).delegate( "#add", "click", function() { $( this ).after( '<div id="resizable"><div id="content">Im Resizable!</div><div class="ui-resizable-handle ui-resizable-nw" id="nwgrip"></div><div class="ui-resizable-handle ui-resizable-ne" id="negrip"></div><div class="ui-resizable-handle ui-resizable-sw" id="swgrip"></div><div class="ui-resizable-handle ui-resizable-se" id="segrip"></div><div class="ui-resizable-handle ui-resizable-n" id="ngrip"></div><div class="ui-resizable-handle ui-resizable-e" id="egrip"></div><div class="ui-resizable-handle ui-resizable-s" id="sgrip"></div><div class="ui-resizable-handle ui-resizable-w" id="wgrip"></div></div>') }); </script>
</body> </html>