2017-09-26 11:17:09 +02:00
|
|
|
viewStatus= "story" /* data story */
|
2017-09-26 13:35:51 +02:00
|
|
|
pagesLoaded= 0
|
|
|
|
totalPages=7;
|
2017-09-25 14:03:53 +02:00
|
|
|
window.onload = function() {
|
|
|
|
width = 1000,
|
|
|
|
height = 1000;
|
|
|
|
loadPageTemplates()
|
|
|
|
|
|
|
|
$('#pagepiling').pagepiling({
|
|
|
|
menu: null,
|
2017-09-26 13:35:51 +02:00
|
|
|
anchors: ["page1","page2","page3","page4","page5","page6","page7"],
|
2017-09-25 14:03:53 +02:00
|
|
|
direction: 'horizontal',
|
|
|
|
verticalCentered: true,
|
|
|
|
scrollingSpeed: 800,
|
|
|
|
easing: 'swing',
|
|
|
|
afterLoad: function(anchorLink, index){
|
|
|
|
//using index
|
|
|
|
$('.btn-navigation.active').removeClass('active')
|
|
|
|
$('#nav-btn-page'+index + " a").addClass('active')
|
|
|
|
}
|
|
|
|
});
|
|
|
|
//turnEventsOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadPageTemplates(){
|
2017-09-25 15:15:33 +02:00
|
|
|
|
2017-09-26 11:17:09 +02:00
|
|
|
|
2017-09-26 13:35:51 +02:00
|
|
|
for (var i=1; i<= totalPages; i++){
|
|
|
|
(function (n) {
|
|
|
|
$('#page-'+n).load("templates/page"+n+".html",function(){
|
|
|
|
counterLoading();
|
|
|
|
loadModalEvent(n);
|
|
|
|
})
|
|
|
|
})(i)
|
|
|
|
}
|
|
|
|
//turnEventsOn();
|
2017-09-26 11:17:09 +02:00
|
|
|
}
|
|
|
|
|
2017-09-26 13:35:51 +02:00
|
|
|
function loadModalEvent(j){
|
2017-09-26 11:17:09 +02:00
|
|
|
var modal = new jBox('Modal', {
|
2017-09-26 13:35:51 +02:00
|
|
|
attach: '#map-btn-page-'+j,
|
|
|
|
content: $('#map-page-'+j),
|
2017-09-26 11:17:09 +02:00
|
|
|
closeButton: 'box'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function counterLoading(){
|
2017-09-26 13:35:51 +02:00
|
|
|
pagesLoaded++;
|
|
|
|
if(pagesLoaded >= totalPages){
|
|
|
|
//Todas las plantillas cargadas
|
2017-09-26 11:17:09 +02:00
|
|
|
$('.menu-content').on("click",'.switchMode', function(e){
|
|
|
|
if(viewStatus=="story") viewStatus="data"
|
|
|
|
else{
|
|
|
|
viewStatus="story"
|
|
|
|
}
|
|
|
|
if(viewStatus=="story"){
|
|
|
|
$('.story-content').show();
|
|
|
|
$('.data-content').hide();
|
|
|
|
$('.menu-content .switchMode').empty().html("ver datos")
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$('.story-content').hide();
|
|
|
|
$('.data-content').show();
|
|
|
|
$('.menu-content .switchMode').empty().html("ver historia")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2017-09-25 14:03:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function turnEventsOn(){
|
2017-09-25 15:15:33 +02:00
|
|
|
/*$('#timeline').on("click",'.btn-navigation', function(e){
|
2017-09-25 14:03:53 +02:00
|
|
|
$('.btn-navigation.active').removeClass('active')
|
|
|
|
$(this).addClass('active')
|
2017-09-25 15:15:33 +02:00
|
|
|
})*/
|
2017-09-26 11:17:09 +02:00
|
|
|
}
|