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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -