Loads the slides (ugly still)

This commit is contained in:
João Batista 2012-08-05 12:00:11 +02:00
parent 2b45ee3bfa
commit 30c1f19b13
3 changed files with 31 additions and 15 deletions

View file

@ -1,24 +1,32 @@
function load_slides() {
var filelist = [
"What is the world made of",
"Strong interactions" /*,
"The Electromagnetic Interaction",
"Nuclear decay and the weak interaction",
"The Three Generations of Matter",
"The Higgs",
"Antimatter"*/
];
"Strong interactions" /*,
"The Electromagnetic Interaction",
"Nuclear decay and the weak interaction",
"The Three Generations of Matter",
"The Higgs",
"Antimatter"*/
];
//$(filelist).each(function(){alert($(this).html());});
var last = false;
for (var i = 0; i < filelist.length; i++ ) {
if (i == filelist.length - 1 ) {
last = true;
}
var filename = to_filename(filelist[i]);
// get
var chapter = get_html(filename, "chapter", "html");
var chapter = get_html(filename, "chapter", "html", last);
//var readmore = get_html(filelist[i], "readmore", "html");
// here we just need the URL
//var icon = get_html(filelist[i], "img", "png");
//
//alert ($.html(chapter));
//alert (chapter);
}
@ -29,10 +37,16 @@ function to_filename(title) {
return title.toLowerCase().replace(/ /g, '_');
}
function get_html(file, prefix, extension ){
function get_html(file, prefix, extension, last ){
$.ajax( "./" + prefix + "/" + file + "." + extension ).done( function(data) {
alert(data);
});
$.ajax( "./" + prefix + "/" + file + "." + extension ).done( function(data) {
//alert('<li class="slide"><div>' + data + "</div></li>");
$("#slider").append('<li class="slide"><div>' + data + "</div></li>");
if (last) {
set_sliders();
}
//return data;
});
}

View file

@ -1,4 +1,4 @@
$(function(){
function set_sliders(){
var slider = $('#slider').bxSlider({
controls: false,
easing: 'easeInOutCubic'
@ -27,4 +27,4 @@ $(function(){
}
});
});
}

View file

@ -75,6 +75,8 @@
// Load slides
load_slides();
// set them sliding
var original_height = $(".navigation").height();
$(".navigation").height('0em');