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() { function load_slides() {
var filelist = [ var filelist = [
"What is the world made of", "What is the world made of",
"Strong interactions" /*, "Strong interactions" /*,
"The Electromagnetic Interaction", "The Electromagnetic Interaction",
"Nuclear decay and the weak interaction", "Nuclear decay and the weak interaction",
"The Three Generations of Matter", "The Three Generations of Matter",
"The Higgs", "The Higgs",
"Antimatter"*/ "Antimatter"*/
]; ];
//$(filelist).each(function(){alert($(this).html());}); //$(filelist).each(function(){alert($(this).html());});
var last = false;
for (var i = 0; i < filelist.length; i++ ) { for (var i = 0; i < filelist.length; i++ ) {
if (i == filelist.length - 1 ) {
last = true;
}
var filename = to_filename(filelist[i]); var filename = to_filename(filelist[i]);
// get // get
var chapter = get_html(filename, "chapter", "html"); var chapter = get_html(filename, "chapter", "html", last);
//var readmore = get_html(filelist[i], "readmore", "html"); //var readmore = get_html(filelist[i], "readmore", "html");
// here we just need the URL // here we just need the URL
//var icon = get_html(filelist[i], "img", "png"); //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, '_'); 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) { $.ajax( "./" + prefix + "/" + file + "." + extension ).done( function(data) {
alert(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({ var slider = $('#slider').bxSlider({
controls: false, controls: false,
easing: 'easeInOutCubic' easing: 'easeInOutCubic'
@ -27,4 +27,4 @@ $(function(){
} }
}); });
}); }

View file

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