Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  11] [ 3]  / answers: 1 / hits: 82950  / 13 Years ago, thu, january 5, 2012, 12:00:00

How can I set CSS using javascript (I don't have access to the CSS file)?


#fade div {
-webkit-transition: opacity 1s;
-moz-transition: opacity 1s;
-o-transition: opacity 1s;
-ms-transition: opacity 1s;
transition: opacity 1s;
opacity: 0;
position: absolute;
height: 500px;
width: 960px;
}

For example:


document.getElementById('fade').HOW-TO-TYPE-webkit-transition = 'opacity 1s';

More From » css

 Answers
3

You should look here: http://www.javascriptkit.com/javatutors/setcss3properties.shtml



As you can see setting CSS Properties with - just results in the next character to be capital:



document.getElementById('fade').style.WebkitTransition = 'opacity 1s';
document.getElementById('fade').style.MozTransition = 'opacity 1s';

[#88216] Wednesday, January 4, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elishaannac

Total Points: 28
Total Questions: 97
Total Answers: 101

Location: Samoa
Member since Mon, Nov 8, 2021
3 Years ago
elishaannac questions
Sun, Dec 5, 21, 00:00, 3 Years ago
Mon, Jun 14, 21, 00:00, 3 Years ago
Mon, Jul 22, 19, 00:00, 5 Years ago
Mon, Jul 8, 19, 00:00, 5 Years ago
;