Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1422 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(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));
                });
        }
});