I had a challenge debugging this problem. I wanted to change the background image of a div, but when I tried it, the background image became blank.
Code: Select all
// dojo.style blanks out the background image
dojo.style( 'dice_cup', 'backgroundImage', 'url(img/dice-cup.gif)' );
// jQuery style.backgroundImage blanks out the background image
$('dice_cup').style.backgroundImage = "url(img/dice-cup.gif)";
// Changing classes to one with a different background image blanks out the background image
dojo.removeClass( 'dice_cup', 'upright' );
dojo.addClass( 'dice_cup', 'shaking' );
// This works: you must use the variable g_gamethemeurl to get to the images
$('dice_cup').style.backgroundImage = "url(" + g_gamethemeurl + "img/dice-cup.gif)";
Does not resolve during play:
https://studio.boardgamearena.com/1/xxx/img/yyy.png
Real path to image:
https://en.1.studio.boardgamearena.com: ... mg/yyy.png
g_gamethemeurl has a value like this:
https://en.1.studio.boardgamearena.com: ... 9999-9999/
It seem to find the real url of the img directory, I need to add the special variable g_gamethemeurl.
Eventually I decided to use two divs with different background images and make one of them visible and the other invisible as needed.
I wanted to get this in the forum so others searching for change changing background-image backgroundImage can find this information. I didn't find it in the wiki - maybe I should post this in the wiki?
If you do this, how are you changing background images on your divs during the game? Is there an easier way?
Thanks, Brian