Help with my Website
I'm working on my first website from scratch, using html and css as of yet. I want to stick to css as much as possible. I'm currently working on the about page, and I want to have previews of articles they can click on and then have the full article they click on pop up in a designated area on the screen. I'm very new at this... I know with the top menu, each menu button is made a link that leads to a different page, would it be overkill to have each article be a link that opens up a different html version of that page, but with that article displayed. some pseudocode the best I can do..
<div class="articlechoose">
<a href="samepagediffarticle1.html">article 1</a>
<a href="samepagediffarticle2.html">article 2</a>
<a href="samepagediffarticle3.html">article 3</a>
<a href="samepagediffarticle4.html">article 4</a>
</div>
<div class="articledisplay">
<article>
......This is where I will put the specific article, the only part of each html thats different
</article>
</div>
I hope this makes sense. I know I could do it in javascript, and I plan on making a more responsive version, but I understand it's best to make it as backwards compatible as possible? Is this something people do for the effect I'm looking for? Is it just another unnecessary page load?
The best way to do this would be in javascript.
In your javascript file
var $iframe = $("#theFrame");
$('#articlechoose a').click(function(event){
event.preventDefault();
var location = $(this).attr("href");
$iframe.attr('src', location);
});
in your html file where you have <article></article> put <iframe id="theFrame"></iframe>
Now I'm not a very big fan of iFrames, but this would be the fastest way to do it. You can style the frame to fit what you need.
Similar Topics | |
---|---|
new to the website |
21 Mar 2024, 2:01 pm |
New to this website |
02 Mar 2024, 6:38 pm |
New to This Website and Joining an Online Community |
20 Mar 2024, 7:47 am |