I've got the following problem. I want an interval to change the marginLeft of an element every 1 second through jQuery. but this has to be the innerWidth of the window class divided by 4.
I have done it as following;
$(document).ready(function() {
var adjust = setInterval(function() {
$(".content").css("marginLeft" : window.innerWidth / 4);
}, 1000);
});
However the console just spits out the following error;
Uncaught SyntaxError: Unexpected identifier
How would you do this to make this work?
Thanks in advance, and I hope you out there can learn of this aswell!
Yes it is wrong syntax: It should be either an object literal
or use comma
$(".content").css({"margin-Left" : window.innerWidth / 4});
or
$(".content").css("margin-Left" , window.innerWidth / 4);