我正在寻找一个 JS 规则,如果 contentheight < 500 则删除一个 div
我已经为图像进行了以下工作,但需要用删除 div 的命令替换图像调整大小:
$(document).ready(function() {
function imageresize() {
var contentheight = $('#maincontainer').height();
if ((contentheight) < '500'){
$('.fluidimage').attr('src','images/big-sm.jpg');
} else {
$('.fluidimage').attr('src','images/big.jpg');
}
}
imageresize();//Triggers when document first loads
$(window).bind("resize", function(){//Adjusts image when browser resized
imageresize();
});
});
非常感谢所有帮助