10 examples of 'jquery css change' in JavaScript

Every line of 'jquery css change' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
36css(style: string, value: string): void {
37 if (value !== '') {
38 this.renderer.setStyle(this.elemRef.nativeElement, style, value);
39 } else {
40 this.renderer.removeStyle(this.elemRef.nativeElement, style);
41 }
42}
1function changeCSS() {
2 // check value of check box
3 var isChecked = $("#color-blind").is(":checked");
4 var cssFile;
5
6 cssFile = "colorblind.css";
7
8 // if we just checked, add new css
9 if (isChecked) {
10 // we dynamically generate a new css link
11 // element with desired name = to desired style sheet
12 var newlink = document.createElement("link");
13 newlink.setAttribute("rel", "stylesheet");
14 newlink.setAttribute("type", "text/css");
15 newlink.setAttribute("href", "/css/" + cssFile);
16 newlink.setAttribute("id", "newcolors");
17
18 document.getElementsByTagName("head").item(0).appendChild(newlink);
19 }
20 // otherwise, we remove the css
21 else {
22 var oldlink = document.getElementById("newcolors")
23
24 document.getElementsByTagName("head").item(0).removeChild(oldlink)
25 }
26}
394function applyCss(element, prop, value) {
395 prop = getStyleProp(prop);
396 element.style[prop] = value;
397}
217function updateCSS(theClass, element, value) {
218 for (var loop = 0; loop < document.styleSheets.length; loop++) {
219 if (document.styleSheets[loop].title == 'cssocms') {
220 try {
221 document.styleSheets[loop].insertRule(theClass + ' { ' + element + ': ' + value + '; }', document.styleSheets[loop][cssRules].length);
222 } catch(err) {
223 try {
224 document.styleSheets[loop].addRule(theClass, element + ': ' + value + ';');
225 } catch (err) {
226 try {
227 if (document.styleSheets[loop]['rules']) {
228 cssRules = 'rules';
229 } else if (document.styleSheets[loop]['cssRules']) {
230 cssRules = 'cssRules';
231 } else {
232 // no rules found... browser unknown
233 }
234
235 for (var inner = 0; inner < document.styleSheets[loop][cssRules].length; inner++) {
236 if (document.styleSheets[loop][cssRules][inner].selectorText == theClass) {
237 if(document.styleSheets[loop][cssRules][inner].style[element]) {
238 document.styleSheets[loop][cssRules][inner].style[element] = value;
239 break;
240 }
241 }
242 }
243 } catch (err) {}
244 }
245 }
246 }
247 }
248}
7function replaceStyle (/* Element */ element, /* String */ selector, /* String */ newValue) {
8 element.setAttribute ('style', selector + ':' + newValue);
9 if (newValue == 'block')
10 element.setAttribute ('aria-hidden', 'false');
11 else if (newValue == 'none')
12 element.setAttribute ('aria-hidden', 'true');
13}
38function css(elem, name, extra, styles) {
39 var val, num, hooks,
40 //转成驼峰写法
41 //background-color -> backgroundColor
42 origName = camelCase(name);
43
44
45}
247function css_delta(val) {
248 return (val > 0 ? '+=' : '-=') + Math.abs(val);
249}
91function css(el, prop) {
92 for (var n in prop)
93 el.style[vendor(el, n)||n] = prop[n]
94
95 return el
96}
120function css (el, prop) {
121 for (var n in prop) {
122 el.style[vendor(el, n) || n] = prop[n]
123 }
124
125 return el
126}
39function css(el, prop) {
40 for (var n in prop) el.style[vendor(el, n) || n] = prop[n];
41 return el;
42}

Related snippets