Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 1423 → Rev 1428

/branches/v5.10-vilmorin/modules/mobile/presentations/js/mobile.js
New file
0,0 → 1,36
$(document).ready(function() {
// Activation du carousel d'images
$('#smartflore-illustrations-galerie-carousel').carousel();
// Pour que les sources s'affichent dans une nouvelle fenêtre
$('#smartflore-footer-button-sources').click(function() {
voirSources();
});
// Pas sur que window.innerWidth puisse jamais être indéfini mais on ne sait jamais
if(!!window.innerWidth) {
var largeurFenetre = window.innerWidth;
// Tablettes / écran moyens, On met du L
if(largeurFenetre > 500 && largeurFenetre < 1000) {
adapterTailleImages('L');
} else {
// Plus de 1000 px, XL est bien plus agréable
if(largeurFenetre >= 1000) {
adapterTailleImages('XL');
}
}
}
function voirSources() {
var w = window.open();
var html = $("#smartflore-sources").html();
$(w.document.body).html(html);
}
function adapterTailleImages(taille) {
$('#smartflore-illustrations-galerie-carousel img').each(function(index) {
var src = $(this).attr('src');
$(this).attr('src', src.replace('S', taille));
});
}
});