Hey there! I have created a gallery using a DIV element with a changing background image depending on the preview image or text that is clicked on.
Since the pictures in the gallery are of different sizes, I decided to use "background-size: contain". The switching function works perfectly in Safari but not as well in Firefox and Chrome.
I'm wondering what I might be doing wrong (why is it only displaying correctly in Safari) and how I should adjust my code. Is there perhaps a better way to achieve this?
<div id="bilder" style="position: absolute; bottom: 0px; left: 0px; width: 100%;
height: -moz-calc(100% - 170px); height: -webkit-calc(100% - 170px); height: -o-calc(100% - 170px);
background: url(https://www.google.de/logos/doodles/2013/holiday-series-2013-2-5173241802915840-hp.png) center bottom no-repeat; background-size: contain; z-index: 1;"></div>
<a onclick="document.getElementById('bilder').style.background='url(http://cdn3.spiegel.de/images/image-550112-thumb-fjcw.jpg) center bottom no-repeat'">google<a>
<a onclick="document.getElementById('bilder').style.background='url(http://cdn3.spiegel.de/images/image-549692-thumb-gsor.jpg) center bottom no-repeat'">bild<a>
Any assistance would be greatly appreciated!