On Nov 12, 2007, at 7:53 PM, Peter E Higgins wrote:

Second, I can't think of any reason to do that over just using "5px"
as the value :)

I am sure there a million shorthand jQuery ways to do it, but getting the value from the anon function (or any other function) seems a very common use case. that example, no- borderTop isn't very vital. but to set something's
top or left position based on the viewport height with some extra
calculations because you happen to need to, it seems kind of useful.

Hi Peter,

I do a lot of that sort of thing, but I do all the calculations before the .css() and just pass in a variable. You probably already know that you can do it that way, but just in case, here is a very simple example:

        var elHeight = $(window).height() / 2;
        $('someelement').css({height: elHeight + 'px'});


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com


Reply via email to