The CSS is cached, so you get a different image only if you do a page reload with force clear cache. If you want a different image when you reload the page then you have to either keep displaying the image from the page content or use JavaScript.
On Fri, Feb 28, 2014 at 6:06 PM, Gerritjan Koekkoek <[email protected]> wrote: > Hi, > > Would like to set a backgroundImage dynamically > (I have attached 25 jpg files to a page) > > If I add this velocity code into my wiki page it works! > {{velocity}} > [[image:Photos.CdLSWorldbanners@${mathtool.random(1, > 25)}.jpg||width="100%"]] > {{/velocity}} > If I add this same code in a stylesheet extension object: > > #document-title{ > background:transparent > url($doc.getAttachmentURL("Photos.CdLSWorldbanners@${mathtool.random(1, > 25)}.jpg")) no-repeat scroll right center; > } > > I get this result if I inspect the CSS in the browser: > background:transparent > url(/xwiki/bin/download/Sandbox/change%2Ddocument/Photos.CdLSWorldbanners%407.jpg) > no-repeat scroll right center > > Any suggestions if this CAN work, and if possible; what am I doing wrong? > > Gerritjan > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
