Advice required on structuring a complex SPA

General issues related to the use of Metro 4
Post Reply
Posts: 1
Joined: Tue Aug 07, 2018 4:44 pm
Status: Offline

Advice required on structuring a complex SPA

Post by Weave » Wed Aug 08, 2018 5:38 pm

I'm planning to use Metro UI to write quite a complex single page application and I'd like some advice on how to structure it. I want it to resemble a desktop application so I will be making use of <div class="window">...</div> for application windows.

Should I create all of the windows in index.html upfront and set them as hidden or do I create them as fragments of html in separate files and use jquery to retrieve them and inject them into the DOM as and when required?

If the user closes a <div class="window">...</div> is it, all its child elements and event listeners automatically removed from the DOM?

Although I have a lot of experience with desktop apps I'm quite a newbie at web stuff (esp. front ends) so any top tips you guys have of how you breakdown the html and js I'd be grateful for.


Posts: 3
Joined: Thu Oct 18, 2018 7:40 am
Status: Offline

Post by Billyrudi » Thu Oct 18, 2018 9:44 am

var clonedDiv = $('#yourdiv').clone();
clonedDiv.attr("id", "newId");

var index = Metro.utils.random(0, 3);
width: 300,
icon: "<span class='mif-"+w_icons[index]+"'></span>",
title: w_titles[index],
content: clonedDiv

Post Reply