我试图用不是填充颜色的图像动态地更改多边形的填充.为此,我找到了一种将填充更改为图像的方法,但是我无法将xlink:href URL动态更改为随机URL.
有什么想法吗?谢谢你的帮助!
width="425" height="319">
xlink:href="http://www.w3.org/1999/xlink" />
$(document).ready(function() {
var randomColor = Math.floor(Math.random()*16777215).toString(16),randomNumber = Math.floor((Math.random()*855)+48),backg = $('#background');
$("body").css("background-color",randomColor);
backg.attr("http://www.w3.org/1999/xlink","xlink:href","url(http://blob.apliiq.com/sitestorage/fabric/" + randomNumber + ".png)");
$('a#cta').attr("href","/designyourown/?fabricID=" + randomNumber );
});