I am trying to write a function in jQuery, which is designed to support browsers that do not support the CSS calc attribute.
I have the following so far:
function calc($element, $xy, $logic, $difference) {
var calc = $($object).$xy() $logic $difference;
return calc;
}
if ($.browser.msie && $.browser.version <= 8) {
var height = calc("body", "height", "-", "80");
$("div#page").css("height", height);
}
I can get away without having a function this one time, but for future reference, I think having this function would be really useful.
Obviously this line:
var calc = $($object).$xy() $logic $difference;
...is going to fail, but I don't know how to pass the variables into it properly.
If anybody has any advice on the syntax, or how I should be writing this line, that would be great.