V
vunet
Hello dear experts,
I have my own JavaScript library which includes some visual effects
for HTML elements. Those elements have CSS style properties which I,
for particular reason, do not want to include in CSS file separately
from library. However, I do want to separate styles aside from their
objects in order to keep them all in one place within a library to
easily modify when needed.
My question is how this can be done in a more or less correct way. I
was thinking about something like:
var style1 = {
backgroundColor:"blue",
color:"white"
}
var myDiv = document.createElement("div");
myDiv.style = style1;
The question is how correct that is and/or is there a better way to do
it?
Thanks a lot.
I have my own JavaScript library which includes some visual effects
for HTML elements. Those elements have CSS style properties which I,
for particular reason, do not want to include in CSS file separately
from library. However, I do want to separate styles aside from their
objects in order to keep them all in one place within a library to
easily modify when needed.
My question is how this can be done in a more or less correct way. I
was thinking about something like:
var style1 = {
backgroundColor:"blue",
color:"white"
}
var myDiv = document.createElement("div");
myDiv.style = style1;
The question is how correct that is and/or is there a better way to do
it?
Thanks a lot.