[英]material design lite append icon
I am having issues with appending a that uses material icons it seems not to load the css / js instead it shows the word check 我在附加使用材质图标的a时遇到问题,似乎没有加载css / js,而是显示了单词check
-this part is coming out of stepper.js -这部分来自stepper.js
var i = document.createElement('i');
i.style.className = 'material-icons';
var text = document.createTextNode('check');
i.appendChild(text);
elements.appendChild(i);
i am wondering how i would reload the js file or the reload the material font section?' 我想知道如何重新加载js文件或重新加载材料字体部分?
my header - how I am loading the styesheet and js 我的标头-我如何加载样式表和js
<script type="text/javascript">
var uid = '{$smarty.session.ipet_user}';
{literal}
function stylesheet(url) {
var s = document.createElement('link');
s.rel = 'stylesheet';
s.async = false;
s.href = url;
var x = document.getElementsByTagName('head')[0];
x.appendChild(s);
}
function script(url) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = url;
//s.defer = true;
var x = document.getElementsByTagName('head')[0];
x.appendChild(s);
}
(function () {
stylesheet('https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css');
stylesheet('https://fonts.googleapis.com/css?family=Roboto');
stylesheet('https://fonts.googleapis.com/icon?family=Material+Icons');
stylesheet('./templates/main/user-theme/tpl-files/material.act.css');
stylesheet('plugins/dropzone/dropzone.css');
stylesheet('plugins/stepper/stepper.min.css');
stylesheet('./templates/main/user-theme/tpl-files/style.css');
stylesheet('./templates/main/style/newprofile.css');
stylesheet('plugins/getmdlselect/getmdl-select.min.css');
script('https://code.getmdl.io/1.3.0/material.min.js');
script('https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js');
script('https://apis.google.com/js/api:client.js');
script('https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyBk99v0F4qkmvxifqOD48YktK-QO-3kopI');
script('./templates/main/user-theme/javascript/google.js');
script('plugins/getmdlselect/getmdl-select.min.js');
script('./templates/main/user-theme/javascript/facebook.js');
script('./templates/main/user-theme/javascript/newprofile.js');
script('./templates/main/javascript/zipcode.js');
script('plugins/stepper/v2/stepper.js');
})();
</script>
You have to define the class for the element via .className
not .style.className
您必须通过
.className
而不是.style.className
定义元素的类
i.className = 'material-icons';
var elements = document.body; var i = document.createElement('i'); i.className = 'material-icons'; var text = document.createTextNode('check'); i.appendChild(text); elements.appendChild(i);
<head> </head> <body> <script> function stylesheet(url) { var s = document.createElement('link'); s.rel = 'stylesheet'; s.async = false; s.href = url; var x = document.getElementsByTagName('head')[0]; x.appendChild(s); } function script(url) { var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = url; //s.defer = true; var x = document.getElementsByTagName('head')[0]; x.appendChild(s); } (function () { stylesheet('https://opensource.keycdn.com/fontawesome/4.7.0/font-awesome.min.css'); stylesheet('https://fonts.googleapis.com/css?family=Roboto'); stylesheet('https://fonts.googleapis.com/icon?family=Material+Icons'); stylesheet('./templates/main/user-theme/tpl-files/material.act.css'); stylesheet('plugins/dropzone/dropzone.css'); stylesheet('plugins/stepper/stepper.min.css'); stylesheet('./templates/main/user-theme/tpl-files/style.css'); stylesheet('./templates/main/style/newprofile.css'); stylesheet('plugins/getmdlselect/getmdl-select.min.css'); script('https://code.getmdl.io/1.3.0/material.min.js'); script('https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'); script('https://apis.google.com/js/api:client.js'); script('https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyBk99v0F4qkmvxifqOD48YktK-QO-3kopI'); script('./templates/main/user-theme/javascript/google.js'); script('plugins/getmdlselect/getmdl-select.min.js'); script('./templates/main/user-theme/javascript/facebook.js'); script('./templates/main/user-theme/javascript/newprofile.js'); script('./templates/main/javascript/zipcode.js'); script('plugins/stepper/v2/stepper.js'); })();</script> </body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.