Hide div when no text added

Permalink
Is it possible to hide a div from the browser if the editable areas within it have not been used (ie they are empty)? But they are available in EditMode and become visible automatically upon text being added to them?

trixiemay
 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Maybe put the divs inside the editable area?
$a = new Area('MyArea');
$a->setBlockWrapperStart('<div>'); 
$a->setBlockWrapperEnd('</div>'); 
$a->display($c);
trixiemay replied on at Permalink Reply
trixiemay
Thanks. Will try that.
Steevb replied on at Permalink Best Answer Reply
Steevb
I use the following code in my themes. First is for a global area:
<?php $a = new GlobalArea('Footer');
     if(($a->getTotalBlocksInArea($c) > 0) || ($c->isEditMode())) {   
        echo '<div class="col-sm-12">';   
       $a->display(); 
       echo '</div>';   
    }?>


<?php $a = new Area('Top');
    if(($a->getTotalBlocksInArea($c) > 0) || ($c->isEditMode())) {   
   echo '<div class="page-top">';
   echo '<div class="col-sm-12">'; 
$a->setAreaGridMaximumColumns(12);
$a->display($c);
echo '</div>'; 
echo '</div>';   
    }?>
trixiemay replied on at Permalink Reply
trixiemay
Thanks Steve.
Yeah its a bit of a pain because the areas the client will be populating with different lists has hardcode svg icons.
Steevb replied on at Permalink Reply
Steevb
Forgot to mention, you should probably wrap the code in a row.