jquery - How to make div item stack -
i have following code works fine trying items stack when moved boxa. how go that?
$(function () { $("#sortable").sortable(); $("#boxa").droppable({ activeclass: 'ui-state-hover', hoverclass: 'ui-state-active', drop: function (event, ui) { $(this).addclass('ui-state-highlight').find('p').html('dropped!'); find('li').children().remove(); } });
<div id='main_content'> <ul id="sortable"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> </ul> <div id='boxa' class='contentboxes'> <div class='contentmenu'>column a</div> <p>drop item on me.</p> </div>
from small amount of code you've given recon problem comes fact you're appending li's onto div , should go ul.
if append them ul within #boxa should stack below each other automatically.
if want them stack on top of each other need add css make them absolutely positioned within ul being dropped into.
Comments
Post a Comment