http://zital.no-ip.org/projects/destacados/
mi idea es que las "regiones" -> .region se queden dentro de las "zonas" .zone
como podréis ver se salen de las zonas :(
Código HTML:
Ver original
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- <link href= "/cms/libs/css/general.css" rel="stylesheet" type="text/css" /> --> <link href= "css/auto/00jquery-ui.css" rel="stylesheet" type="text/css" /> <link href= "css/auto/01jquery-modal.css" rel="stylesheet" type="text/css" /> <link href= "css/auto/03jquery-jgrowl.css" rel="stylesheet" type="text/css" /> <link href= "css/manual/jqueryTable.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> <!-- $(document).ready(function() { /* if(isLogged({type: 'reload'})) { var idcontenido = ''; if(idcontenido) new opened_content(idcontenido); else $.blockUI( { id: 'no_idcontenido', theme: true, title: 'Error', message: $('<div><span>No existe contenido </span><a href="" onclick="window.close;" title="cerrar">cerrar</a></div>') }); } */ $('#zone_content').sortable( { update: function(event, ui) { var item = ui.item; var node = item.get(0).nodeName.toLowerCase(); if(node==='img') { var div = $('<div></div>'); if(item.attr('title')==='add left zone') div.addClass('zone zLeft'); else if(item.attr('title')==='add right zone') div.addClass('zone zRight'); else if(item.attr('title')==='add central zone') div.addClass('zone zCentral'); ui.item.after(div); ui.item.remove(); dynamicSortable(); } if(typeof(console)!='undefined') console.log(ui); } }); $('#zone_title img').draggable( { revert: 'invalid', helper: 'clone', connectToSortable: '#zone_content' }); $('#region_title img').draggable( { revert: 'invalid', helper: 'clone', connectToSortable: '.zone' }); $('#finder_content').sortable( { connectWith: '.region' }); dynamicSortable(); }); var dynamicSortable = function() { $('.zone').sortable( { connectWith: '.zone', update: function(event, ui) { var item = ui.item; var node = item.get(0).nodeName.toLowerCase(); if(node==='img') { var div = $('<div></div>'); if(item.attr('title')==='add col1 region') div.addClass('region rCol1'); else if(item.attr('title')==='add col2 region') div.addClass('region rCol2'); else if(item.attr('title')==='add col3 region') div.addClass('region rCol3'); ui.item.after(div); ui.item.remove(); dynamicSortable(); } if(typeof(console)!='undefined') console.log(ui); } }); $('.region').sortable( { connectWith: '.region, #finder_content' }); }; //--> </script> <style type="text/css">
Código CSS:
Ver original
html,body { margin: 0; padding: 0; height: 100%; width: 100%; } img { border: none; } #hd { } #ft { } #zone_container { min-height: 100%; width: 100%; float: left; width: 69%; height: 100%; border: 1px solid #000000; } #zone_title { margin: 5px; padding: 5px; border: 1px solid #000; } #region_title { margin: 5px; padding: 5px; border: 1px solid #000; } #zone_content { border: 1px solid #000; margin: 5px; padding: 5px; min-height: 100%; } #finder_container { float: right; width: 29%; height: 100%; border: 1px solid #000000; } .zone { background-color: #00ff80; margin: 5px; padding: 5px; border: 3px solid #088a08; min-height: 120px; } .zCentral { width: 100%; float: left; } .zLeft { width: 45%; float: left; } .zRight { width: 45%; float: right; } .region { background-color: #01DFD7; margin: 5px; padding: 10px; border: 2px solid #088A85; min-height: 75px; } .rCol1 { width: 20%; } .rCol2 { width: 45%; } .rCol3 { width: 100%; }
Código HTML:
Ver original
</style> </head> <body> <div id="hd"> </div> <div id="zone_container"> <div id="zone_title"> <img src="resources/img/zone_left.png" title="add left zone" alt="add left zone" /> <img src="resources/img/zone_right.png" title="add right zone" alt="add right zone" /> <img src="resources/img/zone_central.png" title="add central zone" alt="add central zone" /> </div> <div id="region_title"> <img src="resources/img/region_col1.png" title="add col1 region" alt="add col1 region" /> <img src="resources/img/region_col2.png" title="add col2 region" alt="add col2 region" /> <img src="resources/img/region_col3.png" title="add col3 region" alt="add col3 region" /> </div> <div id="zone_content"> <div class="zone zCentral"> <div class="region rCol3"> </div> <div class="region rCol2"> </div> <div class="region rCol1"> </div> </div> <div class="zone zLeft"> <div class="region rCol3"> </div> <div class="region rCol2"> </div> <div class="region rCol1"> </div> </div> <div class="zone zRight"> <div class="region rCol3"> </div> <div class="region rCol2"> </div> <div class="region rCol1"> </div> </div> </div> </div> <div id="finder_container"> <div id="finder_content"> </div> </div> <div id="ft"> </div> </body> </html>