For duplicating alerts, please read the whole question. I AM NOT SEARCHING FADING TRANSITION IMAGE BACKGROUND ON A DIV. What i want is a fading transition of the whole body background image when clicking one of the buttons as show in the snippet. Making a wrapping div could be a solution, but is not the answer i'm looking for.
I found many answers for fading background-images on div but not on the whole body.
There are some negative answers from 2010, i guess there will be something new around. And similar questions with no answer at all:
I´ve got a good solution for fading the body background-color using jquery-ui.js:
But doesn´t work with background-images. Here is the example:
$("#btn1").click(function() {
$('body').removeClass();
$('body').addClass('class1',1000, "easeOutBounce" );
});
$("#btn2").click(function() {
$('body').removeClass();
$('body').addClass('class2',1000, "easeOutBounce" );
});
$("#btn3").click(function() {
$('body').removeClass();
$('body').addClass('class3',1000, "easeOutBounce" );
});
body {align-items: center;
justify-content: center;
text-align: center;
}
body.class1 {
background-image: url(https://1.bp.blogspot.com/-10uYQ232GmA/VB2cCRa0pDI/AAAAAAAAGgw/m9nRdE1d-Rg/s1600/checkerboard-tile-pattern.jpg);
background-repeat:repeat;
}
body.class2 {
background-image: url(http://www.subdude-site.com/WebPages_Local/RefInfo/Computer/WebDev/WebPageTiles/tilesTiles/tile_pattern_marbleTiles_bright_green_256x256.jpg);
background-repeat:repeat;
}
body.class3 {
background-image: url(https://4.bp.blogspot.com/-mCCWT2Qsqe4/UhHnOaJW7KI/AAAAAAAAFRo/4FHJyJdAeko/s1600/glossy-blue-ceramic-tiles-pattern.jpg);
background-repeat:repeat;
}
button {padding: 15px 32px;
margin: 80px 10px;
font-size: 16px;
border-radius: 12px;
border: 2px solid black;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body class="class1">
<button id="btn1">01</button>
<button id="btn2">02</button>
<button id="btn3">03</button>
</body>