Ideas for an issue involving html and css

Asked

Viewed 230 times

1

I’m developing an app where users can send photos that works like this:

The app

When a user chooses multiple photos, through a loop, a form is generated for each photo to fill in the title and description.

The code

<div class="container">
 <div class="col-md-3"><span class="preview">Um preview da imagem enviada aqui</div></div>
 <div class="col-md-12>Aqui irá o formulário referente a foto</div>
</div>
<div class="form">
</div>

The above code is generated through javascript and MUST be between the div container.

I made a small CSS so that when someone clicks on the image preview, the form corresponding to it will appear:

$('body').on('click', '.preview', function(){
    $('.hideform').hide();
    var data = $(this).attr('data-ref');
    myDiv = $('div[data-ref="' + data + '"]');
    myDiv.appendTo('.form).show();
});

The problem

The problem is what I said above. I am using a appendTo so that when the user clicks on the preview, they throw the form in another div so that it looks beautiful.

But I can’t get the fomulario out of the div container due to a limitation of the app at the time of sending.

But if I don’t use the appendTo The view gets awful due to the form appearing right after each image playing everything else down. I would like visualization to appear as follows without having to take it out of the container (using appendTo it leaves and occurs above error):

inserir a descrição da imagem aqui

Like she’d show up if I took the appendTo and the app works properly:

inserir a descrição da imagem aqui

Does anyone have a solution idea for my form to appear this way without I need to remove it from container?

  • There is a bug in your HTML, you open a span and close it as /div...

  • This question seems to be decontextualized because it is about an error in the HTML structure.

  • Notice that one is missing ' here in the class of form: myDiv.appendTo('.form).show();

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.