I have this code:
$(function(){
$( "div.modal-content3" ).on( "swipeleft", swipeleftHandler );
function swipeleftHandler( event ){
if ($('.modal-content').css('display') == 'block' && $('.modal-content2').css('display') == 'block') {
$("div.modal-content3").css({"zIndex":"3", "transform":"scale(0.8)", "marginTop":"-50px", "animationName":"animleft", "animationDuration":"0.7s"});
$("div.modal-content2").css({"zIndex":"4", "transform":"scale(0.9)", "marginTop":"-25px", "animationName":"none", "animationDuration":"0"});
$("div.modal-content").css({"zIndex":"5", "transform":"scale(1)", "marginTop":"0px"});
}
How can i put the css part of the code:
"zIndex":"3", "transform":"scale(0.8)", "marginTop":"-50px", "animationName":"animleft", "animationDuration":"0.7s"
and put it in a variable, to later insert to the jquery code?
i've tried something like this but with no success:
var test = '"zIndex":"3", "transform":"scale(0.8)", "marginTop":"-50px",
"animationName":"animleft", "animationDuration":"0.7s"';
$("div.modal-content3").css({ + test + });
Am i mixing javascript and jquery and is that the reason it doesn't work?