Тема: Draggable help
Показать сообщение отдельно
  #13 (permalink)  
Старый 17.02.2014, 01:02
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,081

xTODx,
ломайте дальше -- копируйте пожалуйста внимательнее!!!
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <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>
  <style type='text/css'>
  body{font:0.8em Arial,sans-serif}
  h1{font-size:1.2em;text-align:center}
  .wrapper{margin:20px auto}
  #block1,#block2,.out{border:solid 1px #555555;margin:10px;padding:20px;-moz-border-radius:5px;-webkit-border-radius:5px;float:left;min-width:100px}
  .textBlock{border:solid 1px #333333;font-weight:bold;margin:10px 0 5px 0;padding:10px;text-align:center;background:#eee;-moz-border-radius:3px;-webkit-border-radius:3px}
  .dropHere{background:#e7e7de}
  .table_drop{width:400px;height:}
  </style>
  <link type="text/css" href="css/custom-theme/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
  <style>
    body{padding:15px;}

	ul { list-style-type: none; margin: 0; padding: 0; margin-bottom: 10px; }
	li { margin: 5px; padding: 5px; width: 150px; }
	#sortable{ min-height: 200px;
				width:250px;
				background: #e6e6e6 url(/css/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;}

  </style>
 <script>
	$(function() {
        	function verify() {
        var texts = [];
        $("#sortable li").each(function (indx, element) {
            texts.push($(element).text() + " ")
        });
        $(".out").html(texts)
    }
		$( "#sortable" ).sortable({
            stop: verify
		});
		$( "#draggable li" ).draggable({
			connectToSortable: "#sortable",
			helper: "clone"
		});
		$( "ul, li" ).disableSelection();
		$("#trash").droppable({
        accept: "#sortable li",
        drop: function (event, ui) {
            ui.draggable.hide("slow", function () {
                $(this).remove();
                verify()
            })
         }
    })

	});
	</script>
</head>
<body>   <div class="out"></div>
<ul id="draggable">
	<li>
    <h3>Section 1</h3>

		<input type="text" name="name"/>
	</li>
	<li>
    <h3>Section 2</h3>
 		<input type="text" name="name2"/>
	</li>
</ul>
<form method="post">
<ul id="sortable">
	<li >Уже готовый модуль</li>
</ul>
<input type="submit" name="go" value='Go'/>
</form>
 <img src="http://www.specodegdaopt.ru/data/medium/korzina_dlya_musora_plats..jpg" alt="" id="trash" width="100" height="120">


</body>
</html>
Ответить с цитированием