I am using this right now…
if($('.current').hasClass('odd') && !$('.current').hasClass('even')) {
var oddMarL = $('.current img').css('margin-left');
var oddMarL2 = $('.touch').css('margin-left');
var oddMarT = $('.touch').css('margin-top');
oddMarL.replace('px', '');
oddMarL2.replace('px', '');
oddMarT.replace('px', '');
Math.abs(oddMarL,oddMarL2,oddMarT);
oddMarL = oddMarL + oddMarL2;
$('#zoom').css('margin-left',oddMarL);
$('#zoom').css('margin-top',oddMarT);
}
Is there something wrong with my code or is it just not possible?
It works until I add the 2 values together or when I use math.abs. In the error console it says margin-left cannot be parsed.
I have reasons for needing it this way so please don’t recommend using a class! 🙂 thanks.
The
replaceandMath.maxfunctions don’t work the way your code seems to assume they would. They return values:and
are necessary to actually change the values. You’d have to do the same thing with the other variables.