javascript - Typo3 and changing CSS values with jQuery -
i've got problem website. i've got 2 divs, in left 1 main content of page , in right div texts. when there content in 1 of divs height bigger other div. tried make css value equal, didn't work @ all. have doublechecked everything, code, file directory etc. still don't see mistake. that's typoscript code include jquery , js-file:
# jquery includejslibs.jquery.external = 1 includejslibs.jquery = http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js # javascript includejs.file1 = fileadmin/script.js
and that's js-file (script.js):
$(document).ready(function() { var contentheight = $(#content).css(["height"]); var sidebarheight = $(#sidebar).css(["height"]); if (contentheight > sidebarheight) { $(#sidebar).height(contentheight - 110); } else { $(#content).height(sidebarheight + 110); } });
edit: forgot css code:
#content { position: relative; background-color: #ffffff; width: 550px; min-height: 510px; border: 2px solid #b7cdd4; border-left-width: 2.5px; border-bottom-width: 0px; float: left; } #sidebar { position: relative; float: right; width: 242px; background-color: #ffffff; min-height: 600px; border: 2px solid #b7cdd4; border-left-width: 2.5px; border-bottom-width: 0px; margin-top: -91px; }
can me? i'd appreciate it.
your jquery
not valid. should be:
$(document).ready(function () { var contentheight = $('#content').css("height"); var sidebarheight = $('#sidebar').css("height"); if (contentheight > sidebarheight) { $('#sidebar').height(contentheight - 110); } else { $('#content').height(sidebarheight + 110); } });
see example (open console , see heights there)
Comments
Post a Comment