// JavaScript Document function redimensionnement(){ var $image = $('img.bg-image'); var image_width = $image.width(); var image_height = $image.height(); var over = image_width / image_height; var under = image_height / image_width; var body_width = $(window).width(); var body_height = $(window).height(); if (body_width > 772) { var aside_width = $("#aside-main").width(); $(".footer-default").css({"width":(body_width - aside_width) + 'px'}); } if (body_width / body_height >= over) { $image.css({ 'width': body_width + 'px', 'height': Math.ceil(under * body_width) + 'px', 'left': '0px', 'top': Math.abs((under * body_width) - body_height) / -2 + 'px' }); } else { $image.css({ 'width': Math.ceil(over * body_height) + 'px', 'height': body_height + 'px', 'top': '0px', 'left': Math.abs((over * body_height) - body_width) / -2 + 'px' }); } } /* Home Background Right */ var currentBackground = 0; var backgrounds = []; backgrounds[0] = 'diaporama-lsp-immobilier-01d.jpg'; backgrounds[1] = 'diaporama-lsp-immobilier-02d.jpg'; backgrounds[2] = 'diaporama-lsp-immobilier-03d.jpg'; backgrounds[3] = 'diaporama-lsp-immobilier-04d.jpg'; backgrounds[4] = 'diaporama-lsp-immobilier-05d.jpg'; backgrounds[5] = 'diaporama-lsp-immobilier-01g.jpg'; backgrounds[6] = 'diaporama-lsp-immobilier-02g.jpg'; backgrounds[7] = 'diaporama-lsp-immobilier-03g.jpg'; backgrounds[8] = 'diaporama-lsp-immobilier-04g.jpg'; backgrounds[9] = 'diaporama-lsp-immobilier-05g.jpg'; function changeHomeBackground() { currentBackground++; if(currentBackground > 9) currentBackground = 0; $('#homeChambre').fadeOut(1500,function() { $('#homeChambre').fadeOut(1500); $('#homeChambre').css({ 'background-image' : "url('https://www.fonciprom.fr/images/interface/" + backgrounds[currentBackground] + "')" }).fadeIn(1500); }); /* $('#homeChambre').fadeTo("slow", 0.9, function() { $(this).css("background-image", "url('https://www.fonciprom.fr/images/interface/" + backgrounds[currentBackground] + "')"); }).fadeTo("slow", 1).delay(1000); */ /* $('#homeChambre').animate({ opacity: 1 }, 600, function() { // Callback "url(" + new_img + ")") $(this).css("background-image", "url('https://www.fonciprom.fr/images/interface/" + backgrounds[currentBackground] + "')").promise().done(function(){ // Callback of the callback :) $(this).animate({ opacity: 1 }, 600) }); }); $('#homeChambre').css("background-image", "url('https://www.fonciprom.fr/images/interface/" + backgrounds[currentBackground] + "')"); */ setTimeout(changeHomeBackground, 5000); } $(document).ready(function(){ // Au chargement initial redimensionnement(); //swiper.update(); // En cas de redimensionnement de la fenĂȘtre $(window).resize(function(){ redimensionnement(); }); });