Iedere post is op dit moment nog hard gecodeerd in het html inderdaad. De site is vooral bedoeld als kladblok terwijl ik een pdf over jQuery doorworstel. Een post bestaat hieruit:
<div class="post">
<h2 class="title"></h2>
<p class="date"></p>
<div class="entry">
<p></p>
</div>
</div>
Het in en uitklappen van de posts werkt met jQuery,
http://jQuery.com/ Alle scripts die hiervoor gebruikt worden staan in het bestandje scripts.js dat bij de pagina geladen wordt.
Bij het (opnieuw) laden van een pagina worden alle posts dicht geklapt en vervolgens de eerste twee weer geopend:
// Script to hide all the posts but the first two on initial load of a page:
$(function() {
$('.entry').hide();
$('.entry:first').show('slow');
$('.entry').eq(1).show('slow');
});
Vervolgens worden de posts geopend en/of gesloten wanneer je erop klikt:
// Script to hide the open posts and any other post that has been clicked on:
$(function() {
$('.post').click(function() {
var s=$('.entry').not($('.entry', this));
s.each(function(){
if ($(this).is(':visible')) {
$(this).slideToggle(1500);
}
});
$('.entry', this).slideToggle(1500);
});
});
Hoop dat dat het wat duidelijker maakt? Als je weer wilt weten over jQuery geef dan maar een gil, dan kan ik je wel een linkje sturen naar interessant boekwerk(je).