2017-09-27 9 views

答えて

2

あなたはJSとスタイルを追加したい場合は、あなたがstyle.sheetのinsertRule()を使用することができ、コード例:あなたはjqueryのを使用して

var sheet = (function() { 
 
\t // Create the <style> tag 
 
\t var style = document.createElement("style"); 
 

 
\t // WebKit hack :(
 
\t style.appendChild(document.createTextNode("")); 
 

 
\t // Add the <style> element to the page 
 
\t document.head.appendChild(style); 
 

 
\t return style.sheet; 
 
})(); 
 

 
// for a test 
 
sheet.insertRule("body { background-color:red;}", sheet.length); 
 

 
// for your code just replace param 
 
// sheet.insertRule("input.star:checked ~ label.star:before {content: '\f005';color: #FD4;transition: all .25s;}}", sheet.length);

関連する問題