I've got two divs (#mosaicBlog and #mosaicAside). I've got #mosaicAside's CSS set to overflow hidden and want to set #mosaicAside to always be the height of #mosaicBlog (dynamic height page to page).
I thought this would work, but it does not seem to be working. I'm thinking it may just be a syntax problem.
$(function(){
var curHeight = parseInt($("#mosaicBlog").height());
newHeight = Math.ceil(curHeight/开发者_开发技巧189) * 189 - 7;
alert(newHeight );
$("#blogAside").height(newHeight);
});
Any help would be appreciated.
Use $(function(){
instead of $({
http://jsbin.com/uzera7/edit
try after loading document
$(document).ready( function() {
var curHeight = parseInt($("#mosaicBlog").height()),
newHeight = Math.ceil(curHeight/189) * 189 - 5;
$("#blogAside").height(newHeight );
});
精彩评论