Is it possible to add a javascript variable into a JQuery .css()? -


i have javascript function loop in it

function blackout() { 'use strict'; (i = 100; > 0; = - 1) {     $("body").css();     } } 

i want add css code using jquery function .css()

-webkit-filter: brightness(i); filter: brightness(i); 

such screen blackout.

what write inside .css() allow me have variable 'i' inside well?

this should make trick:

function blackout() { 'use strict'; $body = $("body"); (i = 100; > 0; = - 1) {     $body.css('-webkit-filter', 'brightness('+ +')');     $body.css('filter', 'brightness('+ +')');     } } 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -