On my site I guess I have about 20 forms, four of which have multiple
hidden divs within the forms of varying sizes.
For all of my forms the following works, but for those with the multiple
divs... it sizes height to the smallest div. What should I do? Should I
JS code specifically for those forms on load of the divs to manage height,
or is there something in my JS that I am not aware and should use.... AND,
of course, if there is a gem to manage centering I would love to learn
about it. The point in centering, is that I want the width of my pages to
be centered and nicely bordered despite browser.... I realize and am sure
that you folks may have excellent alternatives, I would like to know what
you have used.
$(document).ready(function() {
$.fn.center = function() {
var element = $(this);
var e_width = element.width();
var win_width = $(window).width();
var left_margin_calc = (win_width - e_width) / 2;
element.css('margin-left', (left_margin_calc + "px"));
};
$.fn.center_form = function() {
var element = $(this);
var e_width = element.width();
var win_width = $("div.form_wrapper").width();
var left_margin_calc = (win_width - e_width) / 2;
element.css('margin-left', (left_margin_calc + "px"));
var div_height = $("div.form_wrapper").height();
element.css("height", div_height);
element.css('border', '2px solid #4A572B');
};
$("div.form_wrapper").center();
$("form").center_form();
});
Thanks,
Liz McGurty
www.ecomarket.org
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/d29152f6-31f0-49e0-85e2-d6f92ef00440%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.