Reputation: 182
I'm creating a website where there are four sections but only a main page, with a navbar which allows me to switch from one to another section with a pretty cool carousel effect. The HTML code of each section is elsewhere, and I'm using four iframes to load it at the moment. Should I keep using iframes or should I switch to something like ajax and divs? PS. I'm encountering some problems with the height of the iframesat the moment, so I would be glad if you tell me to switch to divs :D EDIT: the code is elsewhere but under my control
Upvotes: 1
Views: 169
Reputation: 1286
I would suggest using a templating system for this instead of iframes. The use of iframes could become troublesome for you going forwards because it would be a little messier to manipulate the DOM freely between those four sections (and potentially not possible dependent on where your content is loaded from), if you ever decide to do that. You'd need to access each iframes document and go from there.
A good example of a templating system is Handlebars JS. This will let you throw chunks of HTML into their own files and call on them to append/insert into the DOM where you please with little function calls.
Upvotes: 2