设置CSS样式里资源地址
xiyuetaCSS().setsrc()属性方法,三种调用方式:
1、xiyuetaCSS(".nav").setsrc("1.jpg"); //设置CSS样式资源地址
2、xiyuetaCSS(".nav").setsrc("server=http://xiyueta.com/images/"); //设置处理后完整地址
3、xiyuetaCSS(".nav").setsrc("dir=../images/"); //设置处理目录后的地址
总结:xiyuetaCSS().setsrc()用法为旧版,对像图片里有,号不处理,如 src: url( ' ../font/a,b,cd,,d,d,d,iconfont.eot?v=256 '); 可以使用xiyuetaCSS().setsrcarr()方法
尝试一下>>
<script src="https://www.xiyueta.com/js/xiyueta.min.js"></script> <script>
xiyuetaCSS().parse("div{color:red}div{color : blu e}div{color:green}.gds{setsrc:url( '/img/xiyueta.jpg ' );color:red}"); console.log(xiyuetaCSS("(all)").setsrc().length);
</script>
4