Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
Ideas to implement modal (Popup) in my web page properly

I'm working on a MVC application and I have built a pop-up system as well. The structure of pop-up is as shown below

<div class="main-content" id="main-content">
    <main role="main" class="">
        @RenderBody()
    </main>
</div>
<div class="notifications-container"></div> <!–– You can ignore ––>
<div class="overlay-modal" id="overlay-modal"></div> <!–– Overlay on the screen (To dark a bit and adds blur) ––>
<div class="modal" id="modal">
    <div> <!–– Pop-up content (Usually Html) ––>
       <button class="modal-close-btn" id="close-btn"><i class="fa fa-times" title="Close"></i></button>
    <!–– Dynamically I'm appending html in here to show the pop-up ––>
    </div>
</div>

Now the problem with this approach is that maintaining pop-up html. For example if I have to show some html as pop-up I having to do something like below.

  1. Create the HTML(UI) to show in the pop-up.
  2. Hide it by setting up display to none.
  3. When the pop-up is triggered, Clone the hidden html and appending it to the #modal div. When the pop up is closed I'm removing the appended item from #modal.
  4. Whenever it triggers, repeating the 3rd step.

I'm finding a bit difficult to maintain HTML in this approach. When the pop-up is up, there will be a duplicate html in the DOM. I had to clone the hidden elements because if I dont, I will lose the UI I need to show if I want it second time (As I would be removing it from the DOM and append it into #modal).

Please suggest any techniques to improve this approach or a better solution altogether. Please comment if you have any questions. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use the Bootstrap framework for a popup modal. It has different types of modal popup designs and is very easy to use.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda